aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-01-12 19:33:19 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-01-12 19:33:19 +0100
commitf34d41db5b8f72d3b82fa1c4e9fe3ad71f509d52 (patch)
treed1490f4f54811c4b3b5213032ca8ec436f918ff3 /tests
parent840d820d0951dc38e266bd4d184be2cf8bf142e3 (diff)
parent32fa47b52b03f4ae84bc773bad785cf77334ae78 (diff)
downloadsylt-f34d41db5b8f72d3b82fa1c4e9fe3ad71f509d52.tar.gz
For-loops
Diffstat (limited to 'tests')
-rw-r--r--tests/simple.tdy28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/simple.tdy b/tests/simple.tdy
index 3fe05a4..2f0f606 100644
--- a/tests/simple.tdy
+++ b/tests/simple.tdy
@@ -13,12 +13,26 @@
// print d
// print c
-a int := 2
-if a == 0 {
- print "123"
-} else if a == 1 {
- print "BCD"
-} else {
- print "ABC"
+for a := 0, a < 10, print a {
+ print a
+ a = a + 1
}
+
// 1, 2, 3, 4
+
+
+//
+// === main ===
+// | Constant(Int(0))
+// | ReadLocal(0)
+// | Constant(Int(10))
+// | Less
+// | JmpFalse(12)
+// | Jmp(11)
+// | Jmp(1)
+// | ReadLocal(0)
+// | Constant(Int(1))
+// | Add
+// | Assign(0)
+// | Jmp(7)
+// | Return