Re:How I wrote a self-hosting C compiler in 40 days
by wtetzner on Tuesday December 15, 2015 @10:30AM
(#10738280)
Ah, gotcha. I struggled with PEG and left recursion for a while before finding GLL. Do you have any resources on how to combine PEG and Pratt?
Re:How I wrote a self-hosting C compiler in 40 days
by sklogic on Tuesday December 15, 2015 @11:31AM
(#10738685)
There must have been some papers on it, but I lost a track. Will try to dig out something.
Meanwhile, you can take a look a my implementation of such a mix: https://github.com/combinatorylogic/mbase/tree/master/src/l/...
An example of a grammar built on top of it: https://github.com/combinatorylogic/clike/blob/master/clike/... - see the `binary` nodes there, they're translated into Pratt while all the others are Packrat.
Left recursive PEG must be reserved for things like method, structure field and array access, which are ok with that algorithm.