News for hackers. Stuff that matters.
Re:PEG Parsers by pacaro on Wednesday July 24, 2019 @01:00PM (#20517174)
Hmm, if you're using a peg parser that doesn't directly support this you can emulate it by choosing between the rhs of the cut and a production that will always match

so

  expr : atom (op <cut> expr)*
Would be replaced with

  expr : atom (op (expr / cut))*
  cut  : "XXX"?
or perhaps simpler

  expr : atom (op expr?)*
Either way when you process the expr rule there will be an empty match where the rhs should be, and an appropriate error can be generated

There are no comments on this comment yet.