diff options
author | Camil Staps | 2017-07-19 12:57:01 +0000 |
---|---|---|
committer | Camil Staps | 2017-07-19 12:57:01 +0000 |
commit | 407a0c8e7e14b96c2a0487cefe09cdc021f002b0 (patch) | |
tree | 6f2f8eec4691c6c292f0cc77734729ac0b27fcf7 /examples/while.sil | |
parent | Nomenclature: Application type is now Expression (diff) |
Add while and !, fix error in consecutive declarations
Diffstat (limited to 'examples/while.sil')
-rw-r--r-- | examples/while.sil | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/while.sil b/examples/while.sil new file mode 100644 index 0000000..2b531d6 --- /dev/null +++ b/examples/while.sil @@ -0,0 +1,19 @@ +Int print(Int n) { + |~ push_a 0 + |~.d 1 0 + |~ jsr _print_graph + |~.o 0 0 + return n; +} + +Int loop(Int start, Int end) { + while (!(start == end)) { + start := print(start); + start := start + 1; + } + return start; +} + +Int main() { + return loop(1, 5); +} |