Lecture 06a: Simple Semantic Analysis
Scopes of Symbols
Identifiers vs Symbols Example
Simple Language with Local Variables
Implementation: Symbol Tables and Error Reporting
Type Checking Rules for a Simple Language
Type Rules: local rules that say how types should agree on each syntax tree node. Can be used to derive type checking algorithms:
- bottom-up: constants have types, variables have types (from declarations), so propagate through operators
- top-down: resulting expressions have types, deduce the types of argument operators
- combination
Rules are declarative specifications, they do not directly say in which direction to propagate
References
- Tiger book, Chapters 4, 5
- Types and Programming Languages, Chapter 5, Chapter 8, Sections 9.1–9.3 (pages 89-107)
- Foundations of Software, the EPFL master's level course taught by Prof. Martin Odersky, covers type systems in greater depth
- Types and Programming Languages, Chapter 5, Chapter 8, Sections 9.1–9.3 (pages 89-107)
- Lambda Calculi with Types, pages 34-45