Control constructs

This commit is contained in:
Dmitry Boulytchev 2018-03-20 23:13:51 +03:00
parent a60a491e73
commit 8409f69983
9 changed files with 98 additions and 2 deletions

View file

@ -1,4 +1,4 @@
TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test015 test017 test018 test019 test020 test021 test022 test023 TESTS=test001 test002 test003 test004 test005 test006 test007 test008 test009 test010 test011 test012 test013 test014 test015 test016 test017 test018 test019 test020 test021 test022 test023
RC=../src/rc.opt RC=../src/rc.opt

View file

@ -1 +1,8 @@
40320 > 10
11
10
11
3
2
1
0

View file

@ -0,0 +1,31 @@
> 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

16
regression/test013.expr Normal file
View file

@ -0,0 +1,16 @@
read (n);
repeat
if n == 1 then write (0)
elif n == 2 then write (1)
elif n == 3 then write (2)
elif n == 4 then write (3)
else write (10)
fi;
if n >= 5 then write (11) fi;
n := n - 1
until n == 0

1
regression/test013.input Normal file
View file

@ -0,0 +1 @@
6

27
regression/test014.expr Normal file
View file

@ -0,0 +1,27 @@
read (n);
while n > 0 do
if n < 1000
then
if n < 500
then
if n < 250
then
if n < 125
then
if n < 63
then
if n < 32
then
write (1)
fi
fi
fi
fi
fi
fi;
n := n - 1
od

1
regression/test014.input Normal file
View file

@ -0,0 +1 @@
100

12
regression/test016.expr Normal file
View file

@ -0,0 +1,12 @@
read (n);
s := 1;
repeat
s := s * n;
n := n - 1
until n == 0;
write (s)

1
regression/test016.input Normal file
View file

@ -0,0 +1 @@
10