diff options
| author | Elis Eriksson <spelis@spelis.li> | 2026-07-01 22:39:28 +0200 |
|---|---|---|
| committer | Elis Eriksson <spelis@spelis.li> | 2026-07-01 22:43:49 +0200 |
| commit | b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf (patch) | |
| tree | 454deffc4365e9d17969d377f13231c06e0c4674 /src/bfc.c | |
| parent | 29766e048cabc8db71cb735c424e0fdfff468198 (diff) | |
| download | bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar.gz bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar.bz2 bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar.lz bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar.xz bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.tar.zst bfc-b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf.zip | |
also omit the lexer entirely, plus the parser type.
Diffstat (limited to 'src/bfc.c')
| -rw-r--r-- | src/bfc.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -1,5 +1,4 @@ #include "all.h" -#include "str.h" #include <stdbool.h> #include <stdio.h> #include <string.h> @@ -12,10 +11,10 @@ int main(int argc, char *argv[]) { bool dump_ast = false; for (int i = 1; i < argc; i++) { - if (strcmp("-cdump", argv[i]) == 0) { + if (strcmp("-cd", argv[i]) == 0) { dump_c = true; } - if (strcmp("-ast_dump", argv[i]) == 0) { + if (strcmp("-ad", argv[i]) == 0) { dump_ast = true; } } @@ -23,14 +22,8 @@ int main(int argc, char *argv[]) { str input = {0}; str_append_fread(&input, stdin); - // Run the lexer to get tokens (honestly useless considering the simplicity of - // BF) - lexer_t lexer = lex_init(&input); - lex_run(&lexer); - // Run the parser and turn tokens into an AST representation - parser_t p = parser_init(&lexer); - ast_node_t *ast = parse_program(&p); + ast_node_t *ast = parse(input.data); ast = optimize_ast(ast); if (dump_ast) ast_dump(ast, 0); |
