commit 0cb46c4ef17ce48349b6c84ad5956fd7eeb93653
parent 007741dad0cb9db0e34c77f2b3c964e568ec0eda
Author: NunoSempere <nuno.sempere@protonmail.com>
Date: Mon, 1 May 2023 10:30:10 -0400
step: savepoint + add very anal compiler flags
Diffstat:
4 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
@@ -7,6 +7,9 @@
## C compiler
CC=tcc # much faster compilation than gcc
+COMPILER_FLAGS=-g3 -Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap
+## ^ from <https://nullprogram.com/blog/2023/04/29/>
+## <https://news.ycombinator.com/item?id=35758898>
## Debugging options
DEBUG=-g#-g
@@ -31,7 +34,7 @@ STYLE_BLUEPRINT=webkit
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
build: $(SRC)
- $(CC) -Wall $(INCS) $(SRC) $(MPC) -o mumble $(LIBS)
+ $(CC) $(COMPILER_FLAGS) $(INCS) $(SRC) $(MPC) -o mumble $(LIBS)
format: $(SRC)
$(FORMATTER) $(SRC)
diff --git a/mumble b/mumble
Binary files differ.
diff --git a/notes/savepoint.txt b/notes/savepoint.txt
@@ -1 +1,2 @@
https://buildyourownlisp.com/chapter7_evaluation#trees
+https://buildyourownlisp.com/chapter9_s_expressions
diff --git a/src/mumble.c b/src/mumble.c
@@ -14,7 +14,7 @@ typedef struct {
int err;
} lispval;
-enum { LISPVAL_NUM, LISPVAL_ERR };
+enum { LISPVAL_NUM, LISPVAL_ERR, LISPVAL_SYM, LISPVAL_SEXPR };
enum { LISPERR_DIV_ZERO, LISPERR_BAD_OP, LISPERR_BAD_NUM };
lispval lispval_num(long x){