User Tools

Site Tools


compilers:sample-lab-exam

Sample programming task

Change/extend the compiler of the While language as follows:

  • Grade 2: Change the definition of variable names (identifiers) so that they have to contain at least one digit.
  • Grade 3: Add the elsif keyword to the language.
  • Grade 4: Change the syntax of if instructions so that it allows multiple branches. Example:
if x < 10 then
   a := 0;
elsif x = 0 then
   a := 1;
else
   a := 2;
end
  • Grade 5: Emit error message if the condition of an elsif is not boolean.
compilers/sample-lab-exam.txt · Last modified: 2016/12/16 22:46 by deva