Eric Abrahamsen writes: > writes: > >> On Tue, Nov 08, 2022 at 08:18:15AM -0800, Eric Abrahamsen wrote: >>> Ihor Radchenko writes: >>> >>> > Eric Abrahamsen writes: >>> > >>> >>> Is there any progress merging peg.el to Emacs? >>> >>> I do not see any obvious blockers in the discussion, but the merge never >>> >>> happened? >> >> [...] >> >>> > As the comment in peg.el states, the definitions are adapted from the >>> > original PEG paper [...] >> >>> This is what I was saying in my original message, though: if peg.el is >>> going to go into core, it probably needs more/better docs than code >>> comments and "read this paper". Its likely users will be Elisp library >>> authors like me, who are just trying to free themselves from regexp hell >>> and want a relatively straightforward alternative. >> >> Yes. Coming from regexp they are deceivingly similar but frustratingly >> different. >> >> The best way I found to wrap my head around them is that they are a >> fancy notation for a recursive descent parser. Thus slightly more >> powerful than regexps, but slightly less than a full YACC (i.e. LALR >> or thereabouts). >> >> What is attractive about them is that one can do "full" parsers >> (as long as your grammar is roughly LL(k)) without having to build >> two storey buildings. I guess it takes some practice, though (I >> haven't). >> >> I think comparing them to treesitter is a category error. > > Okay, this is all sounding good. I'm going to read the paper, try to get > my head around all this, and write some docs for peg.el. Okay, here's a first stab. I read the paper, and understood about half of it, which seemed like enough. It was interesting to see that the paper explicitly calls out the exact greedy-matching behavior I'd encountered. I'm sure I've got some of the conventions wrong, here, and it's unfortunate that there's already a manual node called "Expression Parsing", but I don't know what to call this except "Expression Parsing Grammars"... Eric