Skip to content

Solutions to Lab 5 exercises & Reflection

Written solutions

The written solutions for this week can be download as PDF below.

Download Solutions to Lab 5


I have said that CFLs are important for building compilers. Start by having a look at the grammar rules for Python.

Check Python's "Full Grammar specification"

  • Can you interpret the rules? (Link to code structures you use, e.g. variable assignment, loops, if statements, etc.)
  • See if you can find the grammar for your favourite language.
  • What role does the class of RLs play in compilers?
  • If you are curious then find a course on compilers! (Warning: it is fun but it gets very technical!)


You don't have to hand-in your reflection -- this is not an assessment. Keep your notes and go over them as you understand the material more. Some of the above ideas will become clear in one week, while others will be met again towards the end of the module!