From 6f9393d38e418fa29f37fb2aefc4aab421b47d6e Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sat, 30 Mar 2013 10:46:30 -0400 Subject: added while loop test --- test/while1.lm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/while1.lm 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 -- cgit v1.2.1