From 407a0c8e7e14b96c2a0487cefe09cdc021f002b0 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 19 Jul 2017 12:57:01 +0000 Subject: Add while and !, fix error in consecutive declarations --- examples/while.sil | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/while.sil (limited to 'examples') 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); +} -- cgit v1.2.3