Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db85ed5

Browse files
committed
Add paragraphs on AST branch. AST'ers, please suggest corrections
1 parent 4fe4eb2 commit db85ed5

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Doc/whatsnew/whatsnew25.tex

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,31 @@ \section{Build and C API Changes}
447447

448448
\begin{itemize}
449449

450+
\item The design of the bytecode compiler has changed a great deal, no
451+
longer generating bytecode by traversing the parse tree. Instead
452+
the parse tree is converted to an abstract syntax tree (or AST), and it is
453+
the abstract syntax tree that's traversed to produce the bytecode.
454+
455+
No documentation has been written for the AST code yet. To start
456+
learning about it, read the definition of the various AST nodes in
457+
\file{Parser/Python.asdl}. A Python script reads this file and
458+
generates a set of C structure definitions in
459+
\file{Include/Python-ast.h}. The \cfunction{PyParser_ASTFromString()}
460+
and \cfunction{PyParser_ASTFromFile()}, defined in
461+
\file{Include/pythonrun.h}, take Python source as input and return the
462+
root of an AST representing the contents. This AST can then be turned
463+
into a code object by \cfunction{PyAST_Compile()}. For more
464+
information, read the source code, and then ask questions on
465+
python-dev.
466+
467+
% List of names taken from Jeremy's python-dev post at
468+
% http://mail.python.org/pipermail/python-dev/2005-October/057500.html
469+
The AST code was developed under Jeremy Hylton's management, and
470+
implemented by (in alphabetical order) Brett Cannon, Nick Coghlan,
471+
Grant Edwards, John Ehresman, Kurt Kaiser, Neal Norwitz, Tim Peters,
472+
Armin Rigo, and Neil Schemenauer, plus the participants in a number of
473+
AST sprints at conferences such as PyCon.
474+
450475
\item The built-in set types now have an official C API. Call
451476
\cfunction{PySet_New()} and \cfunction{PyFrozenSet_New()} to create a
452477
new set, \cfunction{PySet_Add()} and \cfunction{PySet_Discard()} to

0 commit comments

Comments
 (0)