aboutsummaryrefslogtreecommitdiff
path: root/src/bfc.c
diff options
context:
space:
mode:
authorElis Eriksson <spelis@spelis.li>2026-07-01 22:39:28 +0200
committerElis Eriksson <spelis@spelis.li>2026-07-01 22:43:49 +0200
commitb2a53020c9e19b6eb7c6b18afb940bdcf0b604cf (patch)
tree454deffc4365e9d17969d377f13231c06e0c4674 /src/bfc.c
parent29766e048cabc8db71cb735c424e0fdfff468198 (diff)
downloadbfc-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
remove utility (ivec, node_vec, str) headersHEADmain
also omit the lexer entirely, plus the parser type.
Diffstat (limited to 'src/bfc.c')
-rw-r--r--src/bfc.c13
1 files changed, 3 insertions, 10 deletions
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 <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);