From e462669c3c3cc04ea29420e14dbb589899d201ec Mon Sep 17 00:00:00 2001 From: Teddy Date: Sat, 3 Aug 2013 12:10:09 +0800 Subject: AST parser can now work! --- main.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 main.cpp (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6a86fe5 --- /dev/null +++ b/main.cpp @@ -0,0 +1,21 @@ +#include "model.h" +#include "builtin.h" +#include "parser.h" +#include + +#ifdef DEBUG +extern Cons *empty_list; +void tree_print(Cons *ptr) { + if (!ptr || ptr == empty_list) return; + ptr->_debug_print(); + tree_print(dynamic_cast(ptr->car)); + tree_print(ptr->cdr); +} +#endif + +int main() { + Tokenizor *tk = new Tokenizor(); + ASTGenerator *ast = new ASTGenerator(); + Cons *tree = ast->absorb(tk); + tree_print(tree); +} -- cgit v1.2.3