Skip to content

Expand Syntax and Enter Symbols

github-actions[bot] edited this page Oct 16, 2026 · 1 revision

For implementation, see ExpandSyntaxAndEnterSymbols.scala.

This algorithm enters the symbols of a source model and expands all syntax in the source model. In general, entering symbols requires expanding templates and vice versa.

Input

  1. An analysis data structure a.

  2. A list tul of translation units.

Output

  1. If the algorithm succeeds, then

    1. An updated analysis data structure a with symbols entered, the use-def map filled in for template names, and the template expansion map filled in.

    2. An updated list tul of translation units with all syntax expanded.

  2. Otherwise an error and no output.

Procedure

  1. Recursively resolve include specifiers. Check for include cycles. Upon detecting an include cycle, halt with an error message.

  2. Add state enums for tul, yielding a new list of translation units tul in which each state machine definition that has a body has a state enum definition.

  3. Enter symbols for a and tul.

  4. Check template definitions for a and tul.

  5. Check template expansions for a and tul.

  6. Check template uses for a and tul.

  7. Expand templates for a and tul, yielding a new list of translation units tul in which each template expansion specifier carries the members that it expands.

  8. Enter template expansion symbols for a and tul.

Clone this wiki locally