Programming Languages and Compilers

 

Lecture 3

 

In this lecture we will look at the syntax analysis phase of the compiler and we will look at how to construct recursive decent parsers from context free grammars.

 

The slides for this lecture can be found here.

 

This lecture should enable you to start building the first version of your own front-end if you are doing a programming language project.

 

Literature

 

Watt and Brown, chapter 4.

 

Exercises

 

Exercises for lecture 3 will be done from 12.30 till 14.15 before Lecture 4 on Tuesday the 24th of February.

 

  1. Do Watt and Brown exercise 4.3 page 130.
  2. Do Watt and Brown exercise 4.4 page 130.
  3. Do Watt and Brown exercise 4.5 page 130.
  4. Do Watt and Brown exercise 4.9 or 4.10 page 131.
  5. Do Watt and Brown exercise 4.11 page 131.
  6. Do Watt and Brown exercise 4.12 page 132.
  7. Do Watt and Brown exercise 4.14 page 132/133.
  8. Do Watt and Brown exercise 4.16 page 133/134.
  9. Do Watt and Brown exercise 4.18 page 134.
  10. Do Watt and Brown exercise 4.21 page 135.  If you are taking this course as a PE course you can do this exercise for your own language or a subset of your own language. If you are taking this course as a SE course I suggest you use a scaled down version of an existing language, e.g. the Mini Java language which you can find on http://geezy.cs.purdue.edu/~samanta/MCIIJ2E/grammar.html