From e48017a6c2c9b7c3d989d660a1561f1ebb415878 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 10 Dec 2023 15:15:47 -0800 Subject: Add more nxs functions --- src/main.c | 2 +- src/parser.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 858334b..ee2c381 100644 --- a/src/main.c +++ b/src/main.c @@ -134,6 +134,7 @@ int main(int argc, char **argv) { } else if (strcmp(argv[1], "-r") == 0 || strcmp(argv[1], "--repl") == 0) { printf("Welcome to the NoExcess REPL.\n"); while (true) { + /* TODO: Finish REPL */ } } @@ -165,7 +166,6 @@ int main(int argc, char **argv) { parser_t *parser = init_parser(lexer); visitor_t *visitor = init_visitor(parser); ast_t *root = eval(visitor); - /* print_root(root); */ ast_free(root); ast_free(visitor->root); visitor_free(visitor); diff --git a/src/parser.c b/src/parser.c index 5f97ef9..12b1256 100644 --- a/src/parser.c +++ b/src/parser.c @@ -140,6 +140,9 @@ void parse_bind(parser_t *parser) { parser_error(parser); token_t *t = parser->tokens[parser->i]; char *name = t->value; + if (hash_table_get(parser->symbol_table, name) != NULL) { + parser_error(parser); + } parser_move(parser); ast_t *expr = parse_expr(parser); /* unevaluated expr will be evaluated when hash table transfers to visitor JIT */ -- cgit