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; \
|
cd src; \
|
||||||
yacc -d parse.y; \
|
yacc -d parse.y; \
|
||||||
lex scan.l
|
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:
|
test-vm:
|
||||||
cd src; \
|
cd src; \
|
||||||
|
|
|
@ -33,6 +33,7 @@ main()
|
||||||
char line[LINE_MAX_LENGTH], last_char;
|
char line[LINE_MAX_LENGTH], last_char;
|
||||||
int char_index;
|
int char_index;
|
||||||
pic_value v;
|
pic_value v;
|
||||||
|
struct pic_proc *proc;
|
||||||
|
|
||||||
pic = pic_open();
|
pic = pic_open();
|
||||||
|
|
||||||
|
@ -54,7 +55,10 @@ main()
|
||||||
/* echo */
|
/* echo */
|
||||||
v = pic_parse(pic, line);
|
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");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue