aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-03 12:10:09 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-03 12:10:09 +0800
commite462669c3c3cc04ea29420e14dbb589899d201ec (patch)
treecc217c58388fbf13229bf4a25b639d17458e8fc9 /main.cpp
parentaf2da07be7d3f8a936640ef92b0692710a22e0d4 (diff)
AST parser can now work!
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp21
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);
+}