diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-03 12:10:09 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-03 12:10:09 +0800 |
commit | e462669c3c3cc04ea29420e14dbb589899d201ec (patch) | |
tree | cc217c58388fbf13229bf4a25b639d17458e8fc9 /main.cpp | |
parent | af2da07be7d3f8a936640ef92b0692710a22e0d4 (diff) |
AST parser can now work!
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
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 <cstdio> + +#ifdef DEBUG +extern Cons *empty_list; +void tree_print(Cons *ptr) { + if (!ptr || ptr == empty_list) return; + ptr->_debug_print(); + tree_print(dynamic_cast<Cons*>(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); +} |