diff options
| author | LLLL Colonq <llll@colonq> | 2025-09-25 20:05:19 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-09-25 20:05:19 -0400 |
| commit | 811f11463851a0f35835ac72ef09b65b1072de20 (patch) | |
| tree | 225cee11b86af7662e6319c9864788b92be3dfb1 /src/main.c | |
| parent | 8e79c8ac42d3fa248174120266ae0988361df212 (diff) | |
Add runtime freezing, add defun and defmacro
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 26 |
1 files changed, 7 insertions, 19 deletions
@@ -12,25 +12,13 @@ int main(int argc, char **argv) { pit_check_error_maybe_panic(rt); pit_lexer *lex = pit_lex_file(argv[1]); - - printf("checking parse...\n"); pit_parser *parse = pit_parser_from_lexer(lex); - pit_value program = pit_parse(rt, parse); - pit_check_error_maybe_panic(rt); - pit_trace(rt, program); - - printf("checking macro expansion...\n"); - pit_value expanded = pit_expand_macros(rt, program); - pit_check_error_maybe_panic(rt); - pit_trace(rt, expanded); - printf("checking free variables...\n"); - pit_value freevars = pit_free_vars(rt, PIT_NIL, expanded); - pit_check_error_maybe_panic(rt); - pit_trace(rt, freevars); - - printf("checking eval...\n"); - pit_value ret = pit_eval(rt, program); - pit_check_error_maybe_panic(rt); - pit_trace(rt, ret); + bool eof = false; + while (!eof) { + pit_value program = pit_parse(rt, parse, &eof); + pit_check_error_maybe_panic(rt); + pit_eval(rt, program); + pit_check_error_maybe_panic(rt); + } } |
