Skip to content

Frontend Passes

AST Processing and the ASTAPI

Internal AST passes may transform the AST iteratively. Internal AST passes are executed as follows:

  1. FindHelpersPass
  2. RelaxExpressionsASTPass
  3. RelaxValueASTPass

The FindHelpersPass

This pass traverses the AST, and generates errors for recovery AST nodes.

The RelaxExpressionsASTPass

This pass transforms all expressions into expressionNodes. This transformation is necessary, as the grammar needs to be non-left-recursive, but transformed rules yield non-trivial trees. These trees are transformed into nicer equivalents, and in that process Expression (which are internal nodes) tree nodes are replaced with ExpressionNode nodes (which are final AST Nodes).

SymbolDB Passes

Internal SymbolDB passes have mutable access to the SymbolDB, and may apply arbitrary transformations/changes.

The internal SymbolDB executes passes in the following order:

  1. GenerateOperationEntitiesPass
  2. GenerateOperationContainerSlotsPass
  3. ResolveEntityMetasPass
  4. ResolveSlotMetasPass
  5. ResolveAnnotationMetasPass
  6. ResolveSlotMetasPass //With annotation resolution enabled
  7. MarkAndAssignContractsPass
  8. ResolveReturnTypesPass
  9. ResolveOverridingOperationsPass
  10. ResolveReferenceValuesPass
  11. ResolveDefaultParametersPass
  12. ParseOperationNodesPass