Skip to content

Semantic Analysis

The next step is to understand what the program is trying to achieve and verify some semantic properties according to Gom’s rules.

We’ll combine the feature set of things we built in the last chapters - visitors, a symbol table and a type system - and put them to work together to analyse the meaning of the program.

Goals of this stage of the compiler:

  1. Construct scopes and populate the symbol table with type and identifier information
  2. Infer types of variables whose types are not explicit, a.k.a. type resolution
  3. Type checking