Skip to content

Commit

Permalink
add factorial
Browse files Browse the repository at this point in the history
  • Loading branch information
JothamWong committed Apr 2, 2024
1 parent f0ac855 commit 7943242
Showing 3 changed files with 27 additions and 0 deletions.
Empty file added .nvmrc
Empty file.
27 changes: 27 additions & 0 deletions factorial.bm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{"tag":"ENTER_SCOPE","num":1}
{"tag":"LDF","arity":1,"addr":3}
{"tag":"GOTO","addr":20}
{"tag":"LD","sym":"x","pos":[2,0]}
{"tag":"LDCI","val":1}
{"tag":"LOG","operator":"=="}
{"tag":"JOF","addr":10}
{"tag":"LD","sym":"x","pos":[2,0]}
{"tag":"RESET"}
{"tag":"GOTO","addr":18}
{"tag":"LD","sym":"x","pos":[2,0]}
{"tag":"LD","sym":"factorial","pos":[1,0]}
{"tag":"LD","sym":"x","pos":[2,0]}
{"tag":"LDCI","val":1}
{"tag":"BINOP","operator":"-"}
{"tag":"CALL","arity":1}
{"tag":"BINOP","operator":"*"}
{"tag":"RESET"}
{"tag":"LDU"}
{"tag":"RESET"}
{"tag":"ASSIGN","pos":[1,0]}
{"tag":"POP"}
{"tag":"LD","sym":"factorial","pos":[1,0]}
{"tag":"LDCI","val":10}
{"tag":"CALL","arity":1}
{"tag":"EXIT_SCOPE"}
{"tag":"DONE"}
Empty file added src/tests/const.ooga
Empty file.

0 comments on commit 7943242

Please sign in to comment.