cleanup
This commit is contained in:
parent
342ed57507
commit
4e4360a0e8
|
@ -37,7 +37,7 @@ LIBPICRIN_HEADERS = \
|
|||
object.h\
|
||||
state.h
|
||||
|
||||
CFLAGS += -I./include -Wall -Wextra -O0 -g
|
||||
CFLAGS += -I./include -Wall -Wextra -g
|
||||
|
||||
mini-picrin: libpicrin.so ext/main.o
|
||||
$(CC) $(CFLAGS) -o $@ libpicrin.so ext/main.o
|
||||
|
|
1751
lib/ext/eval.c
1751
lib/ext/eval.c
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
port = pic_fopen(pic, file, "r");
|
||||
}
|
||||
pic_printf(pic, "~s\n", pic_funcall(pic, "compile", 1, pic_funcall(pic, "expand", 2, pic_read(pic, port), pic_ref(pic, "default-environment"))));
|
||||
pic_printf(pic, "~s\n", pic_funcall(pic, "compile", 1, pic_read(pic, port)));
|
||||
} else {
|
||||
fprintf(stderr, "usage: mini-picrin [-c] [file]\n");
|
||||
exit(1);
|
||||
|
|
|
@ -198,7 +198,7 @@
|
|||
|
||||
(define (expand-define-macro var transformer env)
|
||||
(let ((uid (add-identifier! var env)))
|
||||
(let ((expander (load (compile (expand transformer env)))))
|
||||
(let ((expander (eval transformer env)))
|
||||
(add-macro! uid expander)
|
||||
#undefined)))
|
||||
|
||||
|
@ -223,8 +223,8 @@
|
|||
(else
|
||||
(error "invalid expression" expr))))
|
||||
|
||||
(define (expand expr env)
|
||||
(let ((x (expand-node expr env)))
|
||||
(define (expand expr . env)
|
||||
(let ((x (expand-node expr (if (null? env) default-environment (car env)))))
|
||||
(run-all)
|
||||
x))
|
||||
|
||||
|
@ -884,12 +884,12 @@
|
|||
(codegen-e e)
|
||||
(car (reps))))))
|
||||
|
||||
(lambda (e)
|
||||
(codegen (transform (normalize e))))))
|
||||
(lambda (e . env)
|
||||
(codegen (transform (normalize (apply expand e env)))))))
|
||||
|
||||
|
||||
;; eval
|
||||
|
||||
(define (eval expr . env)
|
||||
(load (compile (expand expr (if (null? env) default-environment (car env)))))))
|
||||
(load (apply compile expr env))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue