diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-04 18:22:24 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-04 18:22:24 -0800 |
commit | 6fe77e2f20f045b89ed10c3952f8f088e9bd3d6c (patch) | |
tree | 37abb7d1b129a0a46bbff940aa1b728d4d4f0dbd /src/main.c | |
parent | f1e455d2fa84067edda695cbba5ddb9e5b77235e (diff) |
fully functional parser (collisions might be a problem)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -63,20 +63,34 @@ int main(int argc, char **argv) { /* printf("%s\n", world->string_value); */ /* printf("%d\n", fal->bool_value); */ - /* TODO: TEST PARSING FUNCTIONS */ - lexer_t *lexer = init_lexer("(lambda (x) (y))"); - printf("why is code not working, part 1\n"); - parser_t *parser = init_parser(lexer); - printf("why is code not working, part 2\n"); - ast_t *root = parse_all(parser); + /* DONE: TEST PARSING FUNCTIONS */ + /* lexer_t *lexer = init_lexer("(lambda (x) (y))"); */ + /* parser_t *parser = init_parser(lexer); */ + /* ast_t *root = parse_all(parser); */ + /* ast_t *func = root->subnodes[0]; */ + /* ast_t *args = func->car; */ + /* ast_t *expr = func->cdr; */ + /* printf("%d\t%s\t\%s\n", func->type, args->car->string_value, */ + /* expr->car->string_value); */ - ast_t *func = root->subnodes[0]; - printf("%d\n", func->type); /* DONE: TEST PARSING QUOTE */ /* lexer_t *lexer = init_lexer("'(hello)"); */ /* parser_t *parser = init_parser(lexer); */ /* ast_t *root = parse_all(parser); */ /* ast_t *quote = root->subnodes[0]; */ /* printf("%s\n", quote->cdr->car->car->string_value); */ + + /* 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); */ + /* if (hash_table_exists(parser->symbol_table, "x")) { */ + /* printf("YES!\n"); */ + /* ast_t *str = hash_table_get(parser->symbol_table, "x"); */ + /* printf("%s\n", str->string_value); */ + /* } */ + + /* TODO: TEST HASH TABLE COLLISIONS */ + /* TODO: TEST LIST EVALUATION */ return 0; } |