otisolsen70 has quit [Remote host closed the connection]
otisolsen70 has joined #pypy
otisolsen70 has quit [Ping timeout: 252 seconds]
jcea has joined #pypy
habnabit_ has quit [Ping timeout: 252 seconds]
habnabit_ has joined #pypy
<korvo>
Okay, I've finished investigating my claim that packrat-style PEG parsers are kind of like partial evaluation. It's not worth a blog post, but I did end up creating a language that I'll probably poke at more.
<korvo>
Short version: yes, technically, a packrat parser can evaluate a rule many times, with different runtime parameters, over a fixed (section of) input text. Each evaluation can generate a fresh semantic action, so it could generate multiple versions of a rule which are themselves specializable.
<korvo>
But *all* of the semantic state can be captured in a sufficiently-rich tree algebra, and we can just ask a rule to emit trees which are specialized by later tree transformations once the parser is finished running.
<korvo>
Also, although I haven't built it, a packrat-memoized Earley parser should be capable of specializing multiple rules in parallel. Really, Earley with lookahead assertions is just parallel PEG.
<korvo>
Anyway I forked META II into a language that compiles to RPython. The language lets users describe a PEG grammar as well as multiple tree algebras and functors from one algebra to another. It compiles itself in 250 lines using three algebras: https://github.com/MostAwesomeDude/zaddy/blob/meta/zaddy.zaddy
<korvo>
The old partial-evaluation annotations are removed because the tree algebras generate much tighter code which doesn't need to be optimized. Still, I documented them here: https://esolangs.org/wiki/Zaddy
uau_ has joined #pypy
uau is now known as Guest2296
Guest2296 has quit [Killed (iridium.libera.chat (Nickname regained by services))]
uau_ is now known as uau
[Arfrever] has quit [Killed (NickServ (GHOST command used by [Arfreve1]))]