LARA Lecture 08: Code Generation for Stack Machines Overview Recall Phases of a Compiler Compilers in Action Overview of Compiling to Stack Machine JVM Instructions Compiled Expression Examples Compiled Counting Examples Compiled Factorial Example Compiling Expressions VM for Expressions Prefix Infix Postfix Notation Printing Prefix Infix Postfix Languages using Prefix or Postfix Only Evaluating Postfix Translating Expressions to Stack Machine Translation Correctness for Expressions Emitting Code for Assignments Accessing and Storing Variables Compiling Statement Sequence Efficiently Emitting Code References JVM Instruction Summary from JVM Spec Compiler Construction by Niklaus Wirth Pascal Implementation