From b2a53020c9e19b6eb7c6b18afb940bdcf0b604cf Mon Sep 17 00:00:00 2001 From: Elis Eriksson Date: Wed, 1 Jul 2026 22:39:28 +0200 Subject: remove utility (ivec, node_vec, str) headers also omit the lexer entirely, plus the parser type. --- src/bfc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/bfc.c') diff --git a/src/bfc.c b/src/bfc.c index 8ef8d3d..593698e 100644 --- a/src/bfc.c +++ b/src/bfc.c @@ -1,5 +1,4 @@ #include "all.h" -#include "str.h" #include #include #include @@ -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); -- cgit v1.3-7-ge9ab