From b747628cbfba50fe3d74f7b8ed316d0bd2d56bdc Mon Sep 17 00:00:00 2001 From: Mistivia Date: Fri, 21 Feb 2025 18:57:46 +0800 Subject: new assembler: tokenizer --- Makefile | 8 +- src/as_main.c | 25 ++++++ src/as_tokenizer.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++ src/as_tokenizer.h | 36 +++++++++ tests/test_as_tokenizer.c | 53 +++++++++++++ 5 files changed, 316 insertions(+), 4 deletions(-) create mode 100644 src/as_main.c create mode 100644 src/as_tokenizer.c create mode 100644 src/as_tokenizer.h create mode 100644 tests/test_as_tokenizer.c diff --git a/Makefile b/Makefile index 6ef7466..bdf1afb 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,15 @@ ldflags = -lm cc = gcc csc = chicken-csc -src = $(shell find src/ -name '*.c' -not -name 'main.c') +src = $(shell find src/ -name '*.c' -not -name '*main.c') obj = $(src:.c=.o) tests=$(shell find tests/ -name '*.c') tests_bin=$(tests:.c=.bin) -all: $(target) fvm-as +all: $(target) fvm-as -fvm-as: assembler/fvm-as.scm - $(csc) $< -o $@ +fvm-as: $(obj) src/as_main.c + $(cc) $(cflags) $(ldflags) $^ -o $@ full: all $(tests_bin) diff --git a/src/as_main.c b/src/as_main.c new file mode 100644 index 0000000..8585fa1 --- /dev/null +++ b/src/as_main.c @@ -0,0 +1,25 @@ +#include + +#include "as_tokenizer.h" + +// AST +// === +// +// ::= +// ::= | +// ::= | | +// ::= | |