Skip to content

Commit

Permalink
Allow for return with no value (default null)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnav-ag committed Apr 1, 2024
1 parent 0ad2589 commit 4aaf5ae
Show file tree
Hide file tree
Showing 5 changed files with 6,810 additions and 6,323 deletions.
42 changes: 10 additions & 32 deletions booga.bm
Original file line number Diff line number Diff line change
@@ -1,42 +1,20 @@
{"tag":"ENTER_SCOPE","num":3}
{"tag":"LDCI","val":5}
{"tag":"ASSIGN","pos":[1,0]}
{"tag":"POP"}
{"tag":"LD","sym":"x","pos":[1,0]}
{"tag":"POP"}
{"tag":"LDF","arity":2,"addr":8}
{"tag":"GOTO","addr":12}
{"tag":"LD","sym":"b","pos":[2,1]}
{"tag":"RESET"}
{"tag":"LDU"}
{"tag":"RESET"}
{"tag":"ASSIGN","pos":[1,1]}
{"tag":"POP"}
{"tag":"LD","sym":"y","pos":[1,1]}
{"tag":"LDCI","val":1}
{"tag":"LDCI","val":2}
{"tag":"CALL","arity":2}
{"tag":"POP"}
{"tag":"LDF","arity":2,"addr":21}
{"tag":"GOTO","addr":36}
{"tag":"ENTER_SCOPE","num":1}
{"tag":"LDCI","val":5}
{"tag":"ASSIGN","pos":[3,0]}
{"tag":"POP"}
{"tag":"LDF","arity":1,"addr":3}
{"tag":"GOTO","addr":11}
{"tag":"LD","sym":"print","pos":[0,0]}
{"tag":"LD","sym":"z","pos":[3,0]}
{"tag":"LD","sym":"i","pos":[2,0]}
{"tag":"CALL","arity":1}
{"tag":"POP"}
{"tag":"LD","sym":"x","pos":[2,0]}
{"tag":"LD","sym":"y","pos":[2,1]}
{"tag":"BINOP","operator":"+"}
{"tag":"LDCI","val":null}
{"tag":"RESET"}
{"tag":"EXIT_SCOPE"}
{"tag":"LDU"}
{"tag":"RESET"}
{"tag":"ASSIGN","pos":[1,0]}
{"tag":"POP"}
{"tag":"LD","sym":"print","pos":[0,0]}
{"tag":"LD","sym":"p","pos":[1,0]}
{"tag":"LDCI","val":1}
{"tag":"LDCI","val":3}
{"tag":"CALL","arity":2}
{"tag":"ASSIGN","pos":[1,2]}
{"tag":"CALL","arity":1}
{"tag":"CALL","arity":1}
{"tag":"EXIT_SCOPE"}
{"tag":"DONE"}
16 changes: 4 additions & 12 deletions booga.ooga
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
var x int = 5;
x;

func y(a int, b int) int, int {
return b;
func p(i int) {
print(i);
return;
}

y(1,2);

var add = func(x int, y int) (int) {
z := 5;
print(z);
return x + y;
}(1,3);
print(p(1));
Loading

0 comments on commit 4aaf5ae

Please sign in to comment.