Module sema

Expand description

The sema module is responsible for semantic analysis of the AST produced by the Parser.

The main part of semantic analysis is type checking (see the type_check module). After that there are additional analyses for unused symbols, label validation, switch statements, and warning about ambiguous (to the reader) expressions that are missing parentheses.

Sema also performs some constant folding.

Modules§

constant_table
The constant_table module defines the ConstantTable type, which tracks all floating-point and string literal constants.
symbol_table
The symbol_table module defines the SymbolTable type and its related types.
type_check
The type_check module defines the main part of the semantic analysis stage, which is type checking. This involves the following tasks:
type_conversion
The type_conversion module provides functionality to convert between data types.
type_resolution
The type_resolution module provides functionality to resolve a declared type into a canonical AstType.

Functions§

semantic_analysis
Analyzes the C AST produced by the Parser for semantic errors, performs typechecking and decorates the AST with their resolved types, and then passes ownership of the AST to the IR lowering stage.