Implemented control constructs

This commit is contained in:
Dmitry Boulytchev 2018-03-20 20:30:58 +03:00
commit a60a491e73
23 changed files with 487 additions and 9 deletions

43
regression/test018.expr Normal file
View file

@ -0,0 +1,43 @@
read (n);
c := 1;
p := 2;
while c do
cc := 1;
while cc do
q := 2;
while q * q <= p && cc do
cc := p % q != 0;
q := q + 1
od;
if cc then cc := 0 else p := p + 1; cc := 1 fi
od;
d := p;
i := 0;
q := n / d;
m := n % d;
while q > 0 && m == 0 do
i := i + 1;
d := d * p;
m := n % d;
if m == 0 then q := n / d else skip fi
od;
write (p);
write (i);
n := n / (d / p);
p := p + 1;
c := n != 1
od