grammar question

Courageous jkraska at san.rr.com
Wed Feb 27 10:47:42 EST 2002


>> For these reasons, saying just "Python's grammar is
>> LL(1)" is oversimplifying things considerably.
>
>If you count the semantic analysis as part of the grammar, I believe
>there would be few programming languages that have a context-free
>grammar.

Indeed. And further, there are sometimes these things we do
when parsing and lexing (which I consider to be about the same
thing in many ways, except that lexing merely operates a character
at at time) which we defer to later. Take for example, postfix
tags on integers to make them long 3L versus 3. This isn't LL
for any finite K. The typical approach is to mutate the AST node
of the object when the final tag is encountered. One doesn't
attempt to have a lexical production for both.

C//




More information about the Python-list mailing list