anatoly techtonik wrote:
where is code that validates that the structure is correct? Is it done on the first level - text file parsing, before ASDL is built? If so, then what is the role of this ADSL exactly that the first step is unable to solve?
I think it's done by the code that traverses the AST and generates bytecode. It complains if it comes across something that it doesn't know how to generate assignment code for. The reason it's done this way is that Python's LL parser can't see far enough ahead to know that it's processing an assignment until it has parsed the whole LHS and gets to the '='. Up to that point, it could well be just something to be evaluated, so it has to accept a general expression. I suppose a validation step could be performed before putting it into the AST, but there's no point, because the problem will become obvious during code generation anyway. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com