added argument type annotations and runtime checks. To do that new opcodes were created (PUSHTYP, PUSHTYPTYP, ERROR)

This commit is contained in:
cozis
2022-08-14 16:25:47 +02:00
parent bc516f470a
commit 6bd60bc84a
18 changed files with 571 additions and 68 deletions
+4 -8
View File
@@ -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: