User Tools

Site Tools


Compilers Exam, 2017-01-10

Programming Part

The following tasks should be solved in the order below. Write tests for each step!

  • Grade 2: Add a new regular expression to the lexer to describe time values of the form HH:MM, where H and M can be any decimal digits.
  • Grade 3: Change the grammar to allow time values to be expressions.
  • Grade 4:
    • Add the following keywords: hour, minute and time.
    • Add the hour and minute functions to the grammar of the expressions. For example:
      • hour(12:38)
      • minute(someVariable)
    • Extend the variable declarations to allow time variables:
      • time someVariable;
  • Grade 5: Extend the semantic analysis:
    • The parameters of hour and minute must be of type time. The return type of these functions is integer.
    • Assignment to a time variable has to be type correct as well.
compilers/exam20170110.txt · Last modified: 2017/01/10 08:56 by deva