diff --git a/Makefile b/Makefile index caa1558..fcba1f5 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,8 @@ main: $(subst .cpp,.o,$(CXXFILES)) prog: main test.fp ./main < test.fp > forsp.ir llc -march=x86 -filetype=obj --relocation-model=pic forsp.ir -O1 - clang -c support.c -m32 -Os - clang support.o forsp.ir.o -m32 -Os + $(CC) -c support.c -m32 -Os + $(CC) support.o forsp.ir.o -m32 -Os clean: rm -f a.out main *.ir *.o diff --git a/README.md b/README.md index 11c76e9..da2908c 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,13 @@ forspll features: * Lisp-style S-expression syntax * Forth-style data stack for parameters/values * Linking with C functions (see `support.c`) +* Recursion: `$self` gets pointer to current function Missing features: +* Captured variables: Functions/lambdas are *not dynamic* and do not capture the state of previously declared variables * Quote operator: `quote`/`'` -* Lists and atoms or any dynamic allocations +* Built-in dynamic allocations (implement them via platform-specific `support.c`) ## Building diff --git a/support.c b/support.c index 44a39e4..44b4583 100644 --- a/support.c +++ b/support.c @@ -43,7 +43,7 @@ void eq() void cons() { int32_t *st = &stack; - int32_t *pair = malloc(2 * sizeof(int32_t)); + int32_t *pair = (int32_t *)malloc(2 * sizeof(int32_t)); --sp; pair[0] = st[sp]; pair[1] = st[sp - 1];