add error.c file
This commit is contained in:
parent
444fc7c750
commit
12e2f10869
2
Makefile
2
Makefile
|
@ -6,7 +6,7 @@ build:
|
|||
cd src; \
|
||||
yacc -d parse.y; \
|
||||
lex scan.l
|
||||
$(CC) -Wall -o bin/picrin -I./include -lreadline src/main.c src/state.c src/gc.c src/pair.c src/port.c src/symbol.c src/value.c src/y.tab.c src/lex.yy.c src/bool.c src/vm.c src/init.c src/number.c src/time.c src/codegen.c
|
||||
$(CC) -Wall -o bin/picrin -I./include -lreadline src/main.c src/state.c src/gc.c src/pair.c src/port.c src/symbol.c src/value.c src/y.tab.c src/lex.yy.c src/bool.c src/vm.c src/init.c src/number.c src/time.c src/codegen.c src/error.c
|
||||
|
||||
clean:
|
||||
rm -f src/y.tab.c src/y.tab.h src/lex.yy.c
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "picrin.h"
|
||||
|
||||
void
|
||||
pic_raise(pic_state *pic, const char *str)
|
||||
{
|
||||
puts(str);
|
||||
abort();
|
||||
}
|
16
src/vm.c
16
src/vm.c
|
@ -1,4 +1,3 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
@ -64,7 +63,6 @@ pic_value
|
|||
pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
|
||||
{
|
||||
struct pic_code *pc;
|
||||
pic_value val;
|
||||
int ai = pic_gc_arena_preserve(pic);
|
||||
|
||||
#if PIC_DIRECT_THREADED_VM
|
||||
|
@ -232,11 +230,8 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
|
|||
NEXT;
|
||||
}
|
||||
CASE(OP_STOP) {
|
||||
goto STOP;
|
||||
}
|
||||
} VM_LOOP_END;
|
||||
pic_value val;
|
||||
|
||||
STOP:
|
||||
val = POP();
|
||||
|
||||
#if VM_DEBUG
|
||||
|
@ -254,11 +249,6 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
|
|||
#endif
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
pic_raise(pic_state *pic, const char *str)
|
||||
{
|
||||
puts(str);
|
||||
abort();
|
||||
}
|
||||
} VM_LOOP_END;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue