From 5ecf1f46aae4994662bd8e3df189f8d60b49a304 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 5 Jan 2023 21:02:26 -0800 Subject: bind works for real, I think this works now --- src/parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 5b8e4fb..b5fc57e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -14,7 +14,7 @@ parser_t *init_parser(lexer_t *lexer) { p->i = 0; p->tokens = malloc(sizeof(token_t *)); - p->symbol_table = init_hash_table(400); + p->symbol_table = init_hash_table(100); p->finished = false; if (p->tokens == NULL) die("malloc on p->tokens"); @@ -132,7 +132,8 @@ void parse_bind(parser_t *parser) { parser_move(parser); ast_t *expr = parse_expr(parser); /* unevaluated expr will be evaluated when hash table transfers to visitor JIT */ - + if (expr == NULL) + parser_error(parser); hash_table_add(parser->symbol_table, name, expr); if (parser->tokens[parser->i]->type != TOKEN_RPAREN) -- cgit