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
Condition( If(IsNight(), Log("Night Time"), Goto("@NightFlow")), Else(Goto("@DayFlow")) )
becomes:
Root node: Condition
Condition
Child 0: If
If
Child 0: IsNight
IsNight
Child 0: None
None
Child 1: Log
Log
Child 0: "Night Time"
"Night Time"
Child 2: Goto
Goto
Child 0: "@NightFlow"
"@NightFlow"
Child 1: Else
Else
Child 0: Goto
Child 0: "@DayFlow"
"@DayFlow"
Last updated 7 months ago