diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-05 12:11:33 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-05 12:11:33 -0800 |
commit | 346507f767d71c69e55b9f663449eb39e1bc7e54 (patch) | |
tree | 5b05f645d4dab681a64efb5ce8801c6442cdd624 /src/main.c | |
parent | c090ab2336d4f2f8536ca47a17f3e689299ea45e (diff) |
lists evaluate for non built-in functions
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -83,7 +83,7 @@ int main(int argc, char **argv) { /* DONE: TEST PARSING AND STORING BINDINGS */ /* lexer_t *lexer = init_lexer("(bind x \"hello world\")"); */ /* parser_t *parser = init_parser(lexer); */ - /* ast_t *root = parse_all(parser); */ + /* parse_all(parser); */ /* if (hash_table_exists(parser->symbol_table, "x")) { */ /* printf("YES!\n"); */ /* ast_t *str = hash_table_get(parser->symbol_table, "x"); */ @@ -92,11 +92,21 @@ int main(int argc, char **argv) { /* TODO: TEST HASH TABLE COLLISIONS */ /* DONE: TEST BUILTIN FUNCTIONS */ - lexer_t *lexer = init_lexer("(/ (+ 3.0 4.0) 4)"); + /* lexer_t *lexer = init_lexer("(* (+ 3.0 4.0) 4)"); */ + /* parser_t *parser = init_parser(lexer); */ + /* visitor_t *visitor = init_visitor(parser); */ + /* ast_t *root = eval(visitor); */ + /* ast_t *res = root->subnodes[0]; */ + /* print(res); */ + /* TODO: TEST NON-BUILTIN FUNCTIONS (stack frame) */ + + lexer_t *lexer = init_lexer("((lambda (x y) (+ x y)) (+ 3.0 4.0) 4)"); parser_t *parser = init_parser(lexer); visitor_t *visitor = init_visitor(parser); + ast_t *root = eval(visitor); ast_t *res = root->subnodes[0]; - printf("%f\n", res->float_value); + print(res); + return 0; } |