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 and 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 8.15 till 10.00 before Lecture 4 on Thursday
the 6th of March.
- Do Watt and Brown exercise 4.3
page 130.
- Do Watt and Brown exercise 4.4
page 130.
- Do Watt and Brown exercise 4.5
page 130.
- Do Watt and Brown exercise 4.9
or 4.10 page 131.
- Do Watt and Brown exercise
4.11 page 131.
- Do Watt and Brown exercise
4.12 page 132.
- Do Watt and Brown exercise
4.14 page 132/133.
- Do Watt and Brown exercise
4.16 page 133/134.
- Do Watt and Brown exercise
4.18 page 134.
- 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