4 ms·
I used to strongly agree with this. This is an article I wrote on the subject 10 years ago: https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsi
by haberman 3y ago
I used to strongly agree with this. This is an article I wrote on the subject 10 years ago: https://blog.reverberate.org/2013/09/ll-and-lr-in-context-why-parsing-tools.html https://blog.reverberate.org/2013/09/ll-and-lr-in-context-wh...
I even had ideas like what you mentioned about encoding precedence and associativity explicitly: https://github.com/haberman/gazelle/blob/a12a123129dfb7e1f3ee6a3f7eef87250cb5ab0e/sketches/lua.gzl#L45-L53 https://github.com/haberman/gazelle/blob/a12a123129dfb7e1f3e...
But I'm no longer as optimistic. The main problem is that nearly all languages have syntax that cannot be easily formalized using declarative abstractions like CFG or PEG, and must fall back to imperative code. And once you have a mix of imperative and declarative code, most of the benefits of a purely-declarative abstraction go away -- or at least the benefits that mattered to me.