grammar question
Justin Sheehy
justin at iago.org
Tue Feb 26 13:54:09 EST 2002
Fernando Pereira <pereira at cis.upenn.edu> writes:
> In general, languages with infix operators and complex nested
> structures like lists are not LL(k), because a parser can only
> decide the role of a subexpression after it sees the operator or
> terminator that follows it.
One can usually (but not always) create an LL(k) grammar for such
languages. It just requires some interesting manipulation of the
grammar productions such as left factoring and removal of left
recursion.
This is a pain to do, but once you have done it you can use a nice
recursive-descent LL(1) parser.
Now, you might not find it worthwhile to do those transformations.
That's your business, and I won't try to make that decision for you.
-Justin
More information about the Python-list
mailing list