X-Git-Url: https://ruin.nu/git/?p=popboot.git;a=blobdiff_plain;f=parser.y;h=663442a8a8bcd87259383c097e418eda5c9680d1;hp=d39a88a34e9c01c5d25804c09e9e243c63ade085;hb=417ea404303c365a53ab2e1db23925cb24b9b6ce;hpb=fa83da5b8474e7308bae9865175c3c228976a1dc diff --git a/parser.y b/parser.y index d39a88a..663442a 100644 --- a/parser.y +++ b/parser.y @@ -8,6 +8,7 @@ #include #include "action.h" + #include "planner.h" using namespace std; @@ -55,7 +56,7 @@ action : id preconds '\n' exec effects '\n' { cout << "id: " << *$1 << endl; // Precondition flags: - cout << "a: " << (*$2)["a"] << endl; + cout << "a: " << (*$2)["NET"] << endl; cout << "b: " << (*$2)["b"] << endl; cout << "c: " << (*$2)["c"] << endl; cout << "d: " << (*$2)["d"] << endl; @@ -64,7 +65,7 @@ action : id preconds '\n' exec effects '\n' { cout << "exe: " << *$4 << endl; // Print number of effects - cout << "1: " << (*$5)[1].size() << endl; + cout << "1: " << (*$5)[0].size() << endl; cout << "99: " << (*$5)[99].size() << endl; cout << "88: " << (*$5)[88].size() << endl; @@ -195,6 +196,16 @@ yyerror (char const *s) cerr << "Parse error : " << s; } +vector stringToVector(string str){ + vector strings; + + istringstream ist(str); + while (ist >> str){ + strings.push_back(str); + } + + return strings; +} int main (int argc, char** argv) @@ -219,4 +230,7 @@ main (int argc, char** argv) actions = new vector(); yyparse(); + + Planner p(*actions, stringToVector(argv[2]), stringToVector(argv[3])); + p.execute(); }