4 ms·
I'm not sure if "middle ground" is quite right; PEGs and CFGs can express a different set of languages, and each has their own advantages. Probably the most imp
by swift 16y ago
I'm not sure if "middle ground" is quite right; PEGs and CFGs can express a different set of languages, and each has their own advantages. Probably the most important tradeoff is that with PEGs you gain infinite lookahead and negation, but you lose left recursion and the ability to express ambiguity.
- silentbicycle 16y agoI meant "middle ground" in a practical sense, rather than the linguistic one - REs are good for simple string hackery, but not sufficient for nested structures. Using an actual parser generator (the yacc clone in your language of choice) can really be overkill for simple things, though. LPEG is a bit more expressive than just REs, but still easy to casually drop in during quick scripting.