3 ms·
Excellent article. One point though: The author compares context-free grammars with LR grammars on the one hand and recursive descent (LL) parsers with LR pars
by choeger 4y ago
Excellent article.
One point though: The author compares context-free grammars with LR grammars on the one hand and recursive descent (LL) parsers with LR parsers.
But in theory, recursive descent parsers are context-free as well. It's just so damn simple to add context to such a parser. And whenever someone does that, the language design itself suffers.
As an example, consider a language like ML, where you want to distinguish module-level identifiers from value-level ones. In context-free languages, the tokens actually differ (e.g., starting with capital letters). If you add context to your parser you might think that constraint can be relaxed. But how do you handle implicit imports then?