aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCamil Staps2017-07-21 07:34:48 +0000
committerCamil Staps2017-07-21 07:34:48 +0000
commit3b6065d5a92d68f19560b83aa810b2533f85c885 (patch)
treef584efbc67608e3776bc4dadccdf13c1ac1ebc63 /examples
parentFix: main can have any result, but no arguments (diff)
Prepend labels with __sil_ to prevent name clashes with C functions
Diffstat (limited to 'examples')
-rw-r--r--examples/while.sil7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/while.sil b/examples/while.sil
index 49186fb..fb2778b 100644
--- a/examples/while.sil
+++ b/examples/while.sil
@@ -1,3 +1,9 @@
+Void sleep(Int n) {
+ |~ pushI_a 0
+ |~ ccall sleep "I:I"
+ |~ pop_b 1
+}
+
Void print(Int n) {
|~ push_a 0
|~.d 1 0
@@ -8,6 +14,7 @@ Void print(Int n) {
Int loop(Int start, Int end) {
while (!(start == end)) {
print(start);
+ sleep(start);
start := start + 1;
}
return start;