replace evaluator in repl to the VM
This commit is contained in:
parent
65c9843d83
commit
ee3442210c
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ build:
|
|||
cd src; \
|
||||
yacc -d parse.y; \
|
||||
lex scan.l
|
||||
gcc -o bin/picrin -I./include src/main.c src/state.c src/gc.c src/pair.c src/write.c src/symbol.c src/value.c src/y.tab.c src/lex.yy.c src/eval.c src/bool.c
|
||||
gcc -o bin/picrin -I./include src/main.c src/state.c src/gc.c src/pair.c src/write.c src/symbol.c src/value.c src/y.tab.c src/lex.yy.c src/eval.c src/bool.c src/vm.c
|
||||
|
||||
test-vm:
|
||||
cd src; \
|
||||
|
|
|
@ -33,6 +33,7 @@ main()
|
|||
char line[LINE_MAX_LENGTH], last_char;
|
||||
int char_index;
|
||||
pic_value v;
|
||||
struct pic_proc *proc;
|
||||
|
||||
pic = pic_open();
|
||||
|
||||
|
@ -54,7 +55,10 @@ main()
|
|||
/* echo */
|
||||
v = pic_parse(pic, line);
|
||||
|
||||
pic_debug(pic, pic_eval(pic, v, pic->global_env));
|
||||
//pic_debug(pic, pic_eval(pic, v, pic->global_env));
|
||||
proc = pic_codegen(pic, v, pic->global_env);
|
||||
v = pic_run(pic, proc, pic_nil_value());
|
||||
pic_debug(pic, v);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue