a few updates and clarifications

This commit is contained in:
Benjamin Peterson 2008-11-03 15:28:02 +00:00
parent e4882ebbad
commit f5be047c58
1 changed files with 16 additions and 14 deletions

View File

@ -2,7 +2,7 @@ PEP: 306
Title: How to Change Python's Grammar Title: How to Change Python's Grammar
Version: $Revision$ Version: $Revision$
Last-Modified: $Date$ Last-Modified: $Date$
Author: Michael Hudson <mwh@python.net>, Jack Diederich <jackdied@gmail.com>, Nick Coghlan <ncoghlan@gmail.com> Author: Michael Hudson <mwh@python.net>, Jack Diederich <jackdied@gmail.com>, Nick Coghlan <ncoghlan@gmail.com>, Benjamin Peterson <musiccomposition@gmail.com>
Status: Active Status: Active
Type: Informational Type: Informational
Content-Type: text/plain Content-Type: text/plain
@ -35,32 +35,34 @@ Checklist
__ Grammar/Grammar: OK, you'd probably worked this one out :) __ Grammar/Grammar: OK, you'd probably worked this one out :)
__ Parser/Python.asdl may need changes to match the Grammar. __ Parser/Python.asdl may need changes to match the Grammar. Run
Use Parser/asdl_c.py to regenerate Include/Python-ast.h make to regenerate Include/Python-ast.h and
Python/Python-ast.c.
__ Python/Python-ast.c may need changes to create the AST __ Python/ast.c will need changes to create the AST objects
objects involved with the Grammar change. Lib/compiler/ast.py involved with the Grammar change. Lib/compiler/ast.py will
will need matching changes to the pure-python AST objects. need matching changes to the pure-python AST objects.
__ Parser/pgen needs to be rerun to regenerate Include/graminit.h __ Parser/pgen needs to be rerun to regenerate Include/graminit.h
and Python/graminit.c and Python/graminit.c. (make should handle this for you.)
__ Python/symbtable.c: This handles the symbol collection pass __ Python/symbtable.c: This handles the symbol collection pass
that happens immediately before the compilation pass that happens immediately before the compilation pass.
__ Python/compile.c: You will need to create or modify the __ Python/compile.c: You will need to create or modify the
compiler_* functions for your productions. compiler_* functions to generate opcodes for your productions.
__ You may need to regenerate Lib/symbol.py and/or Lib/token.py __ You may need to regenerate Lib/symbol.py and/or Lib/token.py
and/or Lib/keyword.py and/or Lib/keyword.py.
__ The parser module. Add some of your new syntax to test_parser, __ The parser module. Add some of your new syntax to test_parser,
bang on parsermodule.c until it passes. bang on Modules/parsermodule.c until it passes.
__ Add some usage of your new syntax to test_grammar.py
__ The compiler package. A good test is to compile the standard __ The compiler package. A good test is to compile the standard
library and test suite with the compiler package and then check library and test suite with the compiler package and then check
it runs. You did add some of your new syntax to the test it runs. Note that this only needs to be done in Python 2.x.
suite, didn't you?
__ If you've gone so far as to change the token structure of __ If you've gone so far as to change the token structure of
Python, then the Lib/tokenizer.py library module will need to Python, then the Lib/tokenizer.py library module will need to