diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-06 11:14:52 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-06 11:14:52 -0800 |
commit | 30f12dfc1f32688f377913c52b131aa78d7830b5 (patch) | |
tree | b59a2822cb6edb062b9965e6dc89b718d65b596b /src/main.c | |
parent | e98f89c84ec0492a36e364ac32987e17296b33df (diff) |
fixed stack bug; found recursion bug
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -78,14 +78,20 @@ int main(int argc, char **argv) { /* print(res); */ /* DONE: TEST NON-BUILTIN FUNCTIONS (stack frame) */ - lexer_t *lexer = init_lexer("(bind my_var 3) (bind hello (lambda (x y) (+ x " - "y))) (hello (+ my_var 4) 4) (+ my_var 4)"); - parser_t *parser = init_parser(lexer); - visitor_t *visitor = init_visitor(parser); - ast_t *root = eval(visitor); - print_root(root); - /* ast_t *res = root->subnodes[0]; */ - /* print(res); */ + /* lexer_t *lexer = init_lexer("(if (= (+ 3 2) 5) 1 2)"); */ + /* parser_t *parser = init_parser(lexer); */ + /* visitor_t *visitor = init_visitor(parser); */ + /* ast_t *root = eval(visitor); */ + /* print_root(root); */ + + /* TODO: TEST RECURSION */ + /* lexer_t *lexer = init_lexer("(bind factorial (lambda (x) (if (<= x 0) 1 (* + * x" */ + /* "(factorial (- x 1)))))) (factorial 3)"); */ + /* parser_t *parser = init_parser(lexer); */ + /* visitor_t *visitor = init_visitor(parser); */ + /* ast_t *root = eval(visitor); */ + /* print_root(root); */ /* lexer_t *lexer = init_lexer("((lambda (x y) (+ x y)) (+ 3 4) 4) (+ 3 * 4)"); */ |