Description of the language that we will create a compiler for

This is a version of the While language, that is often used for education purposes.

The example on the right computes the smallest positive divisor of the number received as input.

Test files can be downloaded!

# Computing the smallest positive divisor.
program divisor
  integer a;
  integer i;
  integer divisor;
  boolean divisorfound;
  read( a );
  divisorfound := false;
  i := 2;
  while not divisorfound and i < a do
    if a mod i = 0 then
      divisorfound := true;
      divisor := i;
    i := i+1;
  if divisorfound then
    write( divisorfound );
    write( divisor );
    write( divisorfound );

Definition of the language: