replace evaluator in repl to the VM

This commit is contained in:
Yuichi Nishiwaki 2013-10-12 12:55:05 +09:00
parent 65c9843d83
commit ee3442210c
3 changed files with 8 additions and 2 deletions

View File

@ -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; \

View File

@ -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");
} }

View File

@ -138,6 +138,7 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env)
return proc; return proc;
} }
#if 0
int int
main() main()
{ {
@ -164,3 +165,4 @@ main()
return 0; return 0;
} }
#endif