From 2fe28946e426e241e87e8381d7a62e73b9278385 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 3 Jan 2023 17:59:18 -0800 Subject: fix bug --- src/parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 7f174a5..ac4d709 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(10000); + p->symbol_table = init_hash_table(1000); p->finished = false; if (p->tokens == NULL) die("malloc on p->tokens"); @@ -117,6 +117,8 @@ ast_t *parse_function(parser_t *parser) { ast_t *car = parse_function_args(parser); ast_t *cdr = parse_expr(parser); /* a function can contain a single expression */ + if (cdr == NULL) + parser_error(parser); parser_eat(parser, TOKEN_RPAREN); return init_ast_function(car, cdr); } -- cgit