diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-03 09:45:40 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-03 09:45:40 -0800 |
commit | b2c539fadfa7ea3eea2e5f7c0c37b5f5f1370c5a (patch) | |
tree | 0f4b9db8c6bf345c9011667c9fbb61393d93a347 /src/main.c | |
parent | 9f342255a2260480701cc2ac2d0c623d4aba1348 (diff) |
actually evaluates and prints something now!
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -1,6 +1,12 @@ #define _GNU_SOURCE +#include "./include/ast.h" +#include "./include/hash_table.h" #include "./include/lexer.h" +#include "./include/parser.h" +#include "./include/print.h" +#include "./include/stack.h" #include "./include/token.h" +#include "./include/visitor.h" #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -8,12 +14,12 @@ int main(int argc, char **argv) { /* Test Lexer */ - lexer_t *lexer = init_lexer("'(fasd \"aaaaaaaa\" 4)"); - token_t *t = lexer_collect_next(lexer); - while (t != NULL) { - printf("%d: %s\n", t->type, t->value); - t = lexer_collect_next(lexer); - } + /* lexer_t *lexer = init_lexer("'(fasd \"aaaaaaaa\" 4)"); */ + /* token_t *t = lexer_collect_next(lexer); */ + /* while (t != NULL) { */ + /* printf("%d: %s\n", t->type, t->value); */ + /* t = lexer_collect_next(lexer); */ + /* } */ /* printf("Welcome to the NXS REPL.\n"); */ /* char *buf = malloc(2); */ @@ -35,5 +41,16 @@ int main(int argc, char **argv) { /* } */ /* } */ + /* TEST PARSER, VISITOR, PRINTER */ + lexer_t *lexer = init_lexer("\"hello world\""); + parser_t *parser = init_parser(lexer); + + ast_t *root = parse_expr(parser); + + visitor_t *v = init_visitor(root); + + ast_t *res = eval_expr(v, root); + + print(res); return 0; } |