diff options
author | Adrian Thurston <thurston@complang.org> | 2013-03-30 10:46:30 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2013-03-30 10:46:30 -0400 |
commit | 6f9393d38e418fa29f37fb2aefc4aab421b47d6e (patch) | |
tree | 33881efae981a311cf656e177cb49b955c146b73 /test/while1.lm | |
parent | 17b032d068d505f6f833d36e07c2c7715e3ee3a7 (diff) | |
download | colm-6f9393d38e418fa29f37fb2aefc4aab421b47d6e.tar.gz |
added while loop test
Diffstat (limited to 'test/while1.lm')
-rw-r--r-- | test/while1.lm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/while1.lm b/test/while1.lm new file mode 100644 index 00000000..645c28d5 --- /dev/null +++ b/test/while1.lm @@ -0,0 +1,52 @@ +##### LM ##### +while 0 + print( '0\n' ) + +global I: int = 3 + +int f() +{ + I = I - 1 + print( ' ' I ) +} + +# simple expr and stmt +while I + f() +print( '\n' ) + +# compound stmt list +I = 3 +while I +{ + I = I - 1 + print( ' ' I ) +} +print( '\n' ) + +# paren expr +I = 3 +while ( I ) + f() +print( '\n' ) + +# expr with computation +I = 3 +while ( I + 1 ) + f() +print( '\n' ) + +# computation and stmt list +I = 3 +while ( I + 2 ) +{ + I = I - 1 + print( ' ' I ) +} +print( '\n' ) +##### EXP ##### + 2 1 0 + 2 1 0 + 2 1 0 + 2 1 0 -1 + 2 1 0 -1 -2 |