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;
begin
  read( a );
  divisorfound := false;
  i := 2;
  while not divisorfound and i < a do
    if a mod i = 0 then
      divisorfound := true;
      divisor := i;
    endif
    i := i+1;
  done
  if divisorfound then
    write( divisorfound );
    write( divisor );
  else
    write( divisorfound );
  endif
end

Definition of the language: