Part I. A Tiny Imperative Language

Table of Contents

2. Syntax Definition and Pretty-Printing
2.1. TIL: a Tiny Imperative Language
2.2. Syntax Definition
2.2.1. Modules
2.2.2. Parse Table Generation
2.2.3. Parsing Programs
2.3. Term Format
2.3.1. Regular Tree Grammars
2.3.2. Signatures
2.3.3. Format Checking
2.4. Pretty-Printing
2.4.1. Pretty-Print Table
2.4.2. Applying Pretty-Print Tables
2.4.3. Adapting the Pretty-Print Table
2.4.4. Restoring Parentheses
2.5. A Complete Pipeline
3. Simplification and Desugaring
3.1. Constant Folding Rules
3.2. Desugaring Rules
3.3. Simplying by Term Rewriting
3.4. Compiling the Simplifier
3.5. Applying the Simplifier
4. Bound Variable Renaming (*)
4.1. Renaming Bound Variables
4.2. Example
5. Typechecking (*)
5.1. Typechecking
5.2. Example
6. Interpretation
6.1. Evaluating Expressions
6.2. Evaluating Variable Accesses
6.3. Evaluating Statements
6.4. The Complete Interpreter
6.5. Running TIL Programs
7. Data-flow Transformation (*)
7.1. Preliminaries
7.2. Constant Propagation
7.3. Copy Propagation
7.4. Reverse Copy Propagation
7.5. Common-subexpression Elimination
7.6. Forward Substitution
7.7. Dead Code Elimination
7.8. Compiling the Transformations
8. Typestate Checking
9. Expression Blocks (*)
9.1. Syntax of Expression Blocks
9.2. Desugaring Expression Blocks
9.3. Example