Ondřej Bílka

Your comment:

> Longest match just tries to hide problems under the rug.
> Instead (A | A B) you have problem with (A B | A) B not matching AB

True, it's the same problem, but I don't think there is anything  hidden
under the rug...

That's the price for a committed choice grammar such as PEG. As Roman says,
it would be nice to have some way to structure how we express things... but
in practice its does not seem to be a big issue.  I found I made more
mistakes with priority choice (wrong order, or a first choice that could
match empty), so I much prefer the longest choice.

I still don't think there is a significant speed problem: thanks Alex, your
experience sounds similar to mine: but Lowell seems to have had less luck..
The parser does need to fail fast, and commit late, and memos sometimes
help, and of course character sets need to be compiled down to eliminate
explicit choice operators anyway, regardless of the type of choice......

Cheers,
Peter
_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to