cleanup
This commit is contained in:
parent
342ed57507
commit
4e4360a0e8
|
@ -37,7 +37,7 @@ LIBPICRIN_HEADERS = \
|
||||||
object.h\
|
object.h\
|
||||||
state.h
|
state.h
|
||||||
|
|
||||||
CFLAGS += -I./include -Wall -Wextra -O0 -g
|
CFLAGS += -I./include -Wall -Wextra -g
|
||||||
|
|
||||||
mini-picrin: libpicrin.so ext/main.o
|
mini-picrin: libpicrin.so ext/main.o
|
||||||
$(CC) $(CFLAGS) -o $@ 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");
|
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 {
|
} else {
|
||||||
fprintf(stderr, "usage: mini-picrin [-c] [file]\n");
|
fprintf(stderr, "usage: mini-picrin [-c] [file]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
|
|
||||||
(define (expand-define-macro var transformer env)
|
(define (expand-define-macro var transformer env)
|
||||||
(let ((uid (add-identifier! var env)))
|
(let ((uid (add-identifier! var env)))
|
||||||
(let ((expander (load (compile (expand transformer env)))))
|
(let ((expander (eval transformer env)))
|
||||||
(add-macro! uid expander)
|
(add-macro! uid expander)
|
||||||
#undefined)))
|
#undefined)))
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@
|
||||||
(else
|
(else
|
||||||
(error "invalid expression" expr))))
|
(error "invalid expression" expr))))
|
||||||
|
|
||||||
(define (expand expr env)
|
(define (expand expr . env)
|
||||||
(let ((x (expand-node expr env)))
|
(let ((x (expand-node expr (if (null? env) default-environment (car env)))))
|
||||||
(run-all)
|
(run-all)
|
||||||
x))
|
x))
|
||||||
|
|
||||||
|
@ -884,12 +884,12 @@
|
||||||
(codegen-e e)
|
(codegen-e e)
|
||||||
(car (reps))))))
|
(car (reps))))))
|
||||||
|
|
||||||
(lambda (e)
|
(lambda (e . env)
|
||||||
(codegen (transform (normalize e))))))
|
(codegen (transform (normalize (apply expand e env)))))))
|
||||||
|
|
||||||
|
|
||||||
;; eval
|
;; eval
|
||||||
|
|
||||||
(define (eval expr . env)
|
(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