syntax
syntax copied to clipboard
Grammar: Support "optional symbol" EBNF notation
Currently one have to explicitly define an optional rule as:
Foo
: Bar OptBaz
;
OptBaz
: Baz
| /* empty */
;
This makes it inconvenient to define a bunch of Opt<Symbol> rules. We can support instead EBNF notation for optional rules:
Foo
: Bar Baz?
;
This can be done as grammar transform by inserting the optional rule (basically transforming to the former version internally).