-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
To improve readability of grammars, adopters can now use the new infix rule notation (#1836) to declare parsing rules used for infix operator parsing:
infix BinaryExpression on PrimaryExpression:
'%' // <-- Highest precedence
> '^'
> '*' | '/'
> '+' | '-'; // <-- Lowest precedence
PrimaryExpression infers Expression:
'(' Expression ')' |
{infer NumberLiteral} value=NUMBER;
Note that the previous tree-rewriting action based grammar is still (and always will be) supported.
In addition to better readability, the new notation also makes use of performance optimizations to speed up expression parsing by roughly 50% compared to the typical way of writing expressions.
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation