summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-05 21:02:26 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-05 21:02:26 -0800
commit5ecf1f46aae4994662bd8e3df189f8d60b49a304 (patch)
tree91b6a15d65c9e8d7a5e7ae87712830b1bf4f4eca /src/parser.c
parent7ff373076c59af3ba166e5080b8ecead569d5a44 (diff)
bind works for real, I think this works now
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c5
1 files changed, 3 insertions, 2 deletions
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)