summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-05 22:29:35 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-05 22:29:35 -0800
commit6c1e4bbfe920feda675d8ea3a13281742d55c334 (patch)
treee4c7d527d3e17406eb235ebb6231ea13a2a4a29b /src/parser.c
parent5ecf1f46aae4994662bd8e3df189f8d60b49a304 (diff)
hash table bug finally fixed forever
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parser.c b/src/parser.c
index b5fc57e..ba9788a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -129,13 +129,14 @@ void parse_bind(parser_t *parser) {
parser_error(parser);
token_t *t = parser->tokens[parser->i];
char *name = t->value;
+ printf("%s\n", name);
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);
-
+ printf("after add\n");
if (parser->tokens[parser->i]->type != TOKEN_RPAREN)
parser_error(parser);
@@ -153,6 +154,7 @@ ast_t *parse_list(parser_t *parser) {
while (current_token->type != TOKEN_RPAREN) {
if (current_token->type == TOKEN_ID) {
if (strcmp(current_token->value, "lambda") == 0 && first_entry) {
+ printf("lambda here\n");
return parse_function(parser);
} else if (strcmp(current_token->value, "bind") == 0 && first_entry) {
parse_bind(parser);
@@ -221,6 +223,7 @@ ast_t *parse_all(parser_t *parser) {
while (t != NULL) {
cur = parse_expr(parser);
if (cur == NULL) {
+ printf("this is happening\n");
t = parser->tokens[parser->i];
continue;
}