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_tablemodule defines the ConstantTable type, which tracks all floating-point and string literal constants. - symbol_
table - The
symbol_tablemodule defines the SymbolTable type and its related types. - type_
check - The
type_checkmodule defines the main part of the semantic analysis stage, which is type checking. This involves the following tasks: - type_
conversion - The
type_conversionmodule provides functionality to convert between data types. - type_
resolution - The
type_resolutionmodule provides functionality to resolve a declared type into a canonicalAstType.
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.