2 ms·
I've always thought it was standard practice to convert to non-left recursive form (when it will be implemented as a recursive descent parser, as it is here). I
by 10ren 17y ago
I've always thought it was standard practice to convert to non-left recursive form (when it will be implemented as a recursive descent parser, as it is here). I would have thought, that for pedagogical purposes, this would be of special importance. Consider the sum() function - why it always begins with calling term() is not clear from the grammar given (because they don't show the transformation):
<sum> ::= <term> | <sum> "+" <term> | <sum> "-" <term>
However, I have to admit that stating the grammar as they have is much clearer, in terms of conveying what the grammar is (as opposed to implementing it). I'm implementing grammars quite often at the moment, so this is food for thought.