-
- Downloads
Custom expression: build a compact version of the syntax tree (#14579)
* Custom expression: build a compact version of the syntax tree The Chevrotain-based parser produces a very verbose syntax tree (matching the grammar productions on every step of the way). For instance, a custom expression as simple as "1" results in the following tree: ``` (root) expression relationalExpression additionExpression multiplicationExpression atomicExpression numberLiteral ``` This makes it hard for type-checker to perform its analysis, due to the need to traverse deeply every one of its children (even if there is only one direct child). The compact syntax tree can be constructed from the above representation, which trims the unnecessary intermediate nodes: ``` (root) numberLiteral ```
Please register or sign in to comment