aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index f32dac3..31d7943 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,6 +2,7 @@
#include "builtin.h"
#include "parser.h"
#include "eval.h"
+#include "exc.h"
#include <cstdio>
#ifdef DEBUG
@@ -15,6 +16,7 @@ void tree_print(Cons *ptr) {
#endif
int main() {
+ //freopen("in", "r", stdin);
Tokenizor *tk = new Tokenizor();
ASTGenerator *ast = new ASTGenerator();
Evaluator *eval = new Evaluator();
@@ -24,6 +26,13 @@ int main() {
Cons *tree = ast->absorb(tk);
if (!tree) break;
//tree_print(tree);
- printf("%s\n", eval->run_expr(tree)->ext_repr().c_str());
+ try
+ {
+ printf("%s\n", eval->run_expr(tree)->ext_repr().c_str());
+ }
+ catch (GeneralError &e)
+ {
+ printf("An error occured: %s\n", e.get_msg().c_str());
+ }
}
}