Created
June 9, 2011 15:59
-
-
Save cotto/1017046 to your computer and use it in GitHub Desktop.
m0 gotos as values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.version 0 | |
.chunk "hello" | |
.constants | |
0 "at start" | |
1 "at end: goto worked!" | |
2 "at end: goto failed :(" | |
.metadata | |
.bytecode | |
set_imm I0, 0, 0 | |
set_imm S0, 0, 0 | |
deref S0, CONSTS, S0 | |
print_s I0, S0, x | |
set_imm I3, do_print | |
goto I3, x, x | |
goto dont_print, x | |
do_print: | |
set_imm S0, 0, 1 | |
deref S0, CONSTS, I0 | |
print_s I0, S0, x | |
exit I0, x, x | |
dont_print: | |
set_imm S0, 0, 2 | |
deref S0, CONSTS, I0 | |
print_s I0, S0, x | |
exit I0, x, x | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment