mirror of
https://github.com/python/cpython.git
synced 2025-09-08 01:41:19 +00:00
Use \citetitle and \programopt as appropriate.
This commit is contained in:
parent
e15eb35fd0
commit
37f1574f2e
13 changed files with 149 additions and 144 deletions
|
@ -35,23 +35,23 @@ the \module{parser} module are presented.
|
|||
|
||||
Most importantly, a good understanding of the Python grammar processed
|
||||
by the internal parser is required. For full information on the
|
||||
language syntax, refer to the \emph{Python Language Reference}. The
|
||||
parser itself is created from a grammar specification defined in the file
|
||||
\file{Grammar/Grammar} in the standard Python distribution. The parse
|
||||
trees stored in the AST objects created by this module are the
|
||||
actual output from the internal parser when created by the
|
||||
\function{expr()} or \function{suite()} functions, described below. The AST
|
||||
objects created by \function{sequence2ast()} faithfully simulate those
|
||||
structures. Be aware that the values of the sequences which are
|
||||
considered ``correct'' will vary from one version of Python to another
|
||||
as the formal grammar for the language is revised. However,
|
||||
transporting code from one Python version to another as source text
|
||||
will always allow correct parse trees to be created in the target
|
||||
version, with the only restriction being that migrating to an older
|
||||
version of the interpreter will not support more recent language
|
||||
constructs. The parse trees are not typically compatible from one
|
||||
version to another, whereas source code has always been
|
||||
forward-compatible.
|
||||
language syntax, refer to the \citetitle[../ref/ref.html]{Python
|
||||
Language Reference}. The parser itself is created from a grammar
|
||||
specification defined in the file \file{Grammar/Grammar} in the
|
||||
standard Python distribution. The parse trees stored in the AST
|
||||
objects created by this module are the actual output from the internal
|
||||
parser when created by the \function{expr()} or \function{suite()}
|
||||
functions, described below. The AST objects created by
|
||||
\function{sequence2ast()} faithfully simulate those structures. Be
|
||||
aware that the values of the sequences which are considered
|
||||
``correct'' will vary from one version of Python to another as the
|
||||
formal grammar for the language is revised. However, transporting
|
||||
code from one Python version to another as source text will always
|
||||
allow correct parse trees to be created in the target version, with
|
||||
the only restriction being that migrating to an older version of the
|
||||
interpreter will not support more recent language constructs. The
|
||||
parse trees are not typically compatible from one version to another,
|
||||
whereas source code has always been forward-compatible.
|
||||
|
||||
Each element of the sequences returned by \function{ast2list()} or
|
||||
\function{ast2tuple()} has a simple form. Sequences representing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue