Parser

The Parser takes the token sequence from the Tokenizer and converts it into an Abstract Syntax Tree (AST).

Each node in the AST represents a command and its arguments or child commands.

Features:

  • Supports multi-level nesting

  • Clearly expresses parent–child relationships

  • Makes serialization and editor visualization easier

Example:

  Condition(
      If(IsNight(), Log("Night Time"), Goto("@NightFlow")),
      Else(Goto("@DayFlow"))
  )

becomes:

  • Root node: Condition

    • Child 0: If

      • Child 0: IsNight

        • Child 0: None

      • Child 1: Log

        • Child 0: "Night Time"

      • Child 2: Goto

        • Child 0: "@NightFlow"

    • Child 1: Else

      • Child 0: Goto

        • Child 0: "@DayFlow"

Last updated