syntax icon indicating copy to clipboard operation
syntax copied to clipboard

Grammar: Support "optional symbol" EBNF notation

Open DmitrySoshnikov opened this issue 8 years ago • 0 comments

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).

DmitrySoshnikov avatar Jan 20 '17 06:01 DmitrySoshnikov