added argument type annotations and runtime checks. To do that new opcodes were created (PUSHTYP, PUSHTYPTYP, ERROR)
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
|
||||
#source
|
||||
|
||||
fun add(a, b) {
|
||||
return a + b;
|
||||
fun nop(a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
#bytecode
|
||||
|
||||
PUSHFUN fun, 2;
|
||||
ASS "add";
|
||||
PUSHFUN fun, 1;
|
||||
ASS "nop";
|
||||
POP 1;
|
||||
JUMP end;
|
||||
fun:
|
||||
ASS "b";
|
||||
POP 1;
|
||||
ASS "a";
|
||||
POP 1;
|
||||
PUSHVAR "a";
|
||||
PUSHVAR "b";
|
||||
ADD;
|
||||
RETURN 1;
|
||||
RETURN 0;
|
||||
end:
|
||||
|
||||
Reference in New Issue
Block a user