PEP 306 changes (How to Change Python's Grammar)
As I found when writing the class decorator patch PEP 306 hasn't been updated since the new AST was added. Here is a suggested replacement block for the Checklist section. AST hackers feel free to make suggestions. Checklist __ Grammar/Grammar: OK, you'd probably worked this one out :) __ Parser/Python.asdl may need changes to match the Grammar. Use Parser/asdl_c.py to regenerate Include/Python-ast.h __ Python/Python-ast.c may need changes to create the AST objects involved with the Grammar change. Lib/compiler/ast.py will need matching changes to the pure-python AST objects. __ Parser/pgen needs to be rerun to regenerate Include/graminit.h and Include/graminit.c __ Python/compile.c: You will need to create or modify the compiler_* functions for your productions. __ You may need to regenerate Lib/symbol.py and/or Lib/token.py and/or Lib/keyword.py __ The parser module. Add some of your new syntax to test_parser, bang on parsermodule.c until it passes. __ The compiler package. A good test is to compile the standard library and test suite with the compiler package and then check it runs. You did add some of your new syntax to the test suite, didn't you? There's a script in Tools/compiler that does this. __ If you've gone so far as to change the token structure of Python, then the tokenizer library module will need to be changed. __ Certain changes may require tweaks to the library module pyclbr. __ Documentation must be written!
Jack Diederich wrote:
__ Python/compile.c: You will need to create or modify the compiler_* functions for your productions.
Python/symtable.c will likely also need attention at this point (it handles the symbol collection pass that occurs before the actual compilation pass) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
Someone please check this in!
On 3/1/07, Nick Coghlan
Jack Diederich wrote:
__ Python/compile.c: You will need to create or modify the compiler_* functions for your productions.
Python/symtable.c will likely also need attention at this point (it handles the symbol collection pass that occurs before the actual compilation pass)
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
Jack Diederich schrieb:
__ Parser/Python.asdl may need changes to match the Grammar. Use Parser/asdl_c.py to regenerate Include/Python-ast.h
On Unix, make will automatically run it when Python.asdl changes.
__ Python/Python-ast.c may need changes to create the AST objects involved with the Grammar change.
This will also change when asdl_c.py runs.
__ Parser/pgen needs to be rerun to regenerate Include/graminit.h and Include/graminit.c
This will also be done by the makefile automatically. Regards, Martin
participants (4)
-
"Martin v. Löwis"
-
Guido van Rossum
-
Jack Diederich
-
Nick Coghlan