Lesson 243
Semantic Analysis & Type Checking
Symbol Tables · Scopes · Type Systems
1:00How a compiler checks the meaning of code after parsing — resolving names, enforcing type rules, and decorating the AST before lowering to an intermediate representation.
By the end, you can
- Explain why a grammatically valid program can still fail semantic analysis.
- Describe what a symbol table stores and how it is used during name resolution.
- Trace a scope-stack lookup and predict which declaration shadows which.
- Identify undeclared-variable, type-mismatch, and wrong-arity errors in sample code.
- Walk a small AST bottom-up and assign types to each node.
- Distinguish static typing from dynamic typing, and explain why type inference is still static.
- Lower a simple arithmetic expression to three-address intermediate code.
- Explain what constant folding and dead-code elimination do and when they apply.
Up next in Theory of Computation & Compilers




