Programming Languages and Compilers

 

Lecture 2

 

In this lecture we will look at a high level way of understanding language processors and we shall look a bit deeper into what is inside a compiler. The slides for this lecture can be found here.

 

Literature

 

Watt and Brown, chapter 2 and chapter 3.

 

Here you can find a short paper: “Bootstrapping a self-compiling compiler from Machine X to Machine Y”, by John. H. Reynolds, describing the application of tombstone- or T- diagrams.

Note the link is only accessible inside the AUC/AAU domain due to copyrights. 

Exercises

 

Exercises for lecture 2 will be done from 12.30 till 14.15 before Lecture 3 on Thursday the 19th of February.

 

  1. Do Watt and Brown exercise 2.2 page 52
  2. Do Watt and Brown exercise 2.4 page 53
  3. Do Watt and Brown exercise 2.9 page 54
  4. Do Watt and Brown exercise 2.1 page 52 (in addition to the questions in the book also think about a JVM bytecode to Java translator and a MSIL to C# translator)
  5. Do Watt and Brown exercise 3.2 page 71
  6. Do Watt and Brown exercise 3.3 page 71
  7. Do Watt and Brown exercise 3.5 page 71
  8. Do Watt and Brown exercise 3.6 page 72
  9. Do Watt and Brown exercise 3.4 page 71
  10. If you haven’t done exercise 11 from lecture 1 by downloading the Triangle compiler and TAM virtual machine, do so now!
  11. Take a look at the Java source code for the Triangle compiler starting with the file Compiler.java in the Triangle directory.