Parser
Parser
Section titled “Parser”The parser converts tokens into an AST.
This process is called syntactic analysis.
For:
let x = 10the parser creates a structure equivalent to:
VariableDeclaration├── name: x└── initializer: 10Expression precedence
Section titled “Expression precedence”The parser uses precedence levels:
assignment ↓logical OR ↓logical AND ↓equality ↓comparison ↓term ↓factor ↓unary ↓call ↓primaryFor:
a + b * 2the parser produces:
+ / a * / b 2rather than:
* / + 2 / a bSo the expression means:
a + (b * 2)