diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-10 21:48:31 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-10 21:48:31 (GMT) |
commit | 5180e4666a314db36a15d953fdfa38af4f285758 (patch) | |
tree | 412e127800aa6d57b4a1f675e4bd206b418f62a8 /test/src | |
parent | 6c7886228f574939ad20ec740543d2aa172bdf42 (diff) | |
download | uscxml-5180e4666a314db36a15d953fdfa38af4f285758.zip uscxml-5180e4666a314db36a15d953fdfa38af4f285758.tar.gz uscxml-5180e4666a314db36a15d953fdfa38af4f285758.tar.bz2 |
More work on promela DM
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/test-promela-parser.cpp | 73 |
1 files changed, 48 insertions, 25 deletions
diff --git a/test/src/test-promela-parser.cpp b/test/src/test-promela-parser.cpp index d89bb73..6dc58d1 100644 --- a/test/src/test-promela-parser.cpp +++ b/test/src/test-promela-parser.cpp @@ -11,34 +11,57 @@ using namespace uscxml; using namespace boost; +extern int promela_debug; int main(int argc, char** argv) { + promela_debug = 0; + + std::list<std::string> expressions; + /* declarations */ +// expressions.push_back("bool b1"); +// expressions.push_back("bool b1;"); +// expressions.push_back("bool b1, b2, b3"); +// expressions.push_back("bool b1, b2, b3;"); +// expressions.push_back("bool b1, b2 = 3 + 4, b3, b4, b5;"); +// expressions.push_back("bool b1; bool b2; bool b3; bool b4;"); +// expressions.push_back("bool b1; bool b2; bool b3, b4, b5;"); +// expressions.push_back("bit b = 1;"); +// expressions.push_back("byte state = 1;"); +// expressions.push_back("bool b1, b2 = 1, b3;"); +// expressions.push_back("bool busy[3];"); +// expressions.push_back("bool busy[3], us[4];"); +// expressions.push_back("mtype = {\nred, white, blue,\nabort, accept, ack, sync_ack, close, connect,\ncreate, data, eof, open, reject, sync, transfer,\nFATAL, NON_FATAL, COMPLETE\n}"); - { - PromelaParser ast("bit b;"); - ast.dump(); - } - - { - PromelaParser ast1("a + (1 << b)"); - PromelaParser ast2("(a + 1) << b"); - ast1.dump(); - ast2.dump(); - } - - { - PromelaParser ast("(b < N)"); - ast.dump(); - } - - { - PromelaParser ast("i+1"); - ast.dump(); - } - - { - PromelaParser ast("(mt+1)%MAX;"); - ast.dump(); + /* expressions */ +// expressions.push_back("i+1"); +// expressions.push_back("(x == false || t == Bturn);"); +// expressions.push_back("a + (1 << b)"); +// expressions.push_back("(a + 1) << b"); +// expressions.push_back("(b < N)"); +// expressions.push_back("(mt+1)%MAX;"); + + /* statements */ +// expressions.push_back("t = Bturn;"); +// expressions.push_back("c++"); +// expressions.push_back("state = state - 1"); +// expressions.push_back("printf(\"hello world\\n\")"); +// expressions.push_back("printf(\"result %d: %d\n\", id, res, foo, bar)"); +// expressions.push_back("printf(\"x = %d\n\", x)"); +// expressions.push_back("(n <= 1)"); +// expressions.push_back("res = (a*a+b)/2*a;"); +// expressions.push_back("assert(0) /* a forced stop, (Chapter 6) */"); +// expressions.push_back("assert(count == 0 || count == 1)"); + + for (std::list<std::string>::iterator exprIter = expressions.begin(); + exprIter != expressions.end(); + exprIter++) { + try { + std::cout << std::endl << "'" << *exprIter << "':" << std::endl; + PromelaParser ast(*exprIter); + ast.dump(); + } catch (Event e) { + std::cerr << e << std::endl; + } } }
\ No newline at end of file |