summaryrefslogtreecommitdiff
path: root/src/main.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/main.c
parent5ecf1f46aae4994662bd8e3df189f8d60b49a304 (diff)
hash table bug finally fixed forever
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index f418925..56608c1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -78,14 +78,35 @@ int main(int argc, char **argv) {
/* print(res); */
/* DONE: TEST NON-BUILTIN FUNCTIONS (stack frame) */
- lexer_t *lexer = init_lexer(
- "(bind hello 3) ((lambda (x y) (+ x y)) (+ hello 4) 4) (+ 3 4)");
+ lexer_t *lexer = init_lexer("(bind my_func (lambda (x y) (+ x "
+ "y))) (my_func (+ 3 4) 4) (+ 3 4)");
+ printf("%ld\n", hash("my_func", 100));
+ printf("%ld\n", hash("my_func", 100));
+ printf("debug 1\n");
parser_t *parser = init_parser(lexer);
+ printf("debug 2\n");
visitor_t *visitor = init_visitor(parser);
+ printf("debug 3\n");
ast_t *root = eval(visitor);
+ printf("debug 4\n");
print_root(root);
- /* ast_t *res = root->subnodes[0]; */
- /* print(res); */
+ printf("debug 5\n");
+ ast_t *res = root->subnodes[0];
+ print(res);
+
+ /* lexer_t *lexer = init_lexer("((lambda (x y) (+ x y)) (+ 3 4) 4) (+ 3
+ * 4)"); */
+ /* printf("debug 1\n"); */
+ /* parser_t *parser = init_parser(lexer); */
+ /* printf("debug 2\n"); */
+ /* visitor_t *visitor = init_visitor(parser); */
+ /* printf("debug 3\n"); */
+ /* ast_t *root = eval(visitor); */
+ /* printf("debug 4\n"); */
+ /* print_root(root); */
+ /* printf("debug 5\n"); */
+ /* ast_t *res = root->subnodes[0]; */
+ /* print(res); */
/* TODO: TEST REPL POSSIBILITY */
/* printf("Welcome to the NXS REPL.\n"); */