3 ms·
This is all true, for sure, but I'd like to point out that PEGs are a formalism that isn't much harder to learn than regular expressions, and totally appropriat
by groovy2shoes 10y ago
This is all true, for sure, but I'd like to point out that PEGs are a formalism that isn't much harder to learn than regular expressions, and totally appropriate for parsing a fairly large class of languages. I've also seen PEG-based (pakrat) parser generators for just about every programming language (some better than others, of course). Again, these tend to be not much harder to learn than regular expressions, and because of the "ordered choice" operator, many programmers seem more comfortable reasoning about PEGs than a Yacc specificiation, for example.
PEGs aren't the only formalism that attempts to make writing certain classes of parsers easy. You can get a long way with parser combinators, and Matthew Might's "Yacc is Dead" paper discusses another (extremely general) approach, which I have unfortunately not seen many implementations of.
Anyway, enough of an addendum! Keep on spreading the Good Word ;)
- mikekchar 10y agoThanks for addending :-) I wasn't aware of PEGs. That definitely does look promising for a lot of cases.
- corysama 10y agoI recommend checking out https://en.m.wikipedia.org/wiki/OMeta https://en.m.wikipedia.org/wiki/OMeta and https://github.com/cdglabs/ohm https://github.com/cdglabs/ohm
- joshmarinacci 10y agoThis. OMeta and Ohm are awesome.