News for hackers. Stuff that matters.
Re:Which Parsing Approach? by UncleEntity on Tuesday September 15, 2020 @03:54PM (#24485995)
Something like:

  expr ::= <all the other expressions>
         | '(' [ expr { ',' expr } ] ')'
         | '{' { expr } '}'
         | expr '=>' expr
         | identifer '(' expr { ',' expr } ')'
         | literal
Tried adding it to the javascript grammar I play with and the parser generator (Coco/R) didn't complain about conflicts -- though it doesn't have tuples so YMMV.

--edit--

Played with it a bit more and added tuples (as a replacement for '(' expr ')' grouping expression (exactly like the now-edited example above) and it still seems happy. If I were to add this to the grammar for real I'd have to monkey around with it some more to ensure there was an actual '(' ... ')' expression before the => but seems easily doable by transforming the grammar a bit.

There are no comments on this comment yet.