The following is a valid µOCCAM program that performs I/O. The name is a little misleading, it checks your code generation for constant value declaration and use, but it also checks your arrays but only very naively (spelling?). P.S. try changing one of the VAL declarations to read VAL caroline IS 0 : and then use that name, my parser gives up claiming I haven't declared the variable. It's a very strange bug, either in my code or the symbol_table code.
Program file:
/public/cs3/web/ipptests/constant.io
INT laura = 0 : VAL jane IS 5 : [5] INT sarah : VAL lisa IS 1 : SEQ WHILE laura < jane SEQ stdin ? sarah [laura] laura := laura + lisa laura := laura - 1 WHILE laura >= 0 SEQ stdout ! sarah [laura] laura := laura - lisa
When provided with this input:
/public/cs3/web/ipptests/constant.in
0 1 2 3 4
it should generate the following output:
/public/cs3/web/ipptests/constant.out
==> 4 ==> 3 ==> 2 ==> 1 ==> 0