Skip to content

The "Phases" of a Compiler

1549980240707

Syntax Analysis

Syntax

  • Lexical analysis
    • Regular expressions
  • Parsing
    • Context Free Grammar

Contextual analysis

Contextual constraints

  • Scope checking
    • Scope rules (static semantics)
  • Type checking
    • Type rules (static semantics)

Code Generations

Semantics (dynamic semantics)

Organization of a Compiler

1549980548507

Scanner

  • Source program -> tokens
    • Part of Syntax analysis

Parser

  • tokens -> abstract syntax tree (AST)
    • Part of Syntax analysis

Symbol table

  • Created from AST
    • Part of Contextual analysis

Semantic analysis: AST decoration

  • Part of code generation

Last update: June 14, 2019