Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / node792.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-compiler.visitor.html" />
13<link rel="prev" href="node791.html" />
14<link rel="parent" href="compiler.html" />
15<link rel="next" href="module-compiler.ast.html" />
16<meta name='aesop' content='information' />
17<title>19.3 Python Abstract Syntax</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="19.2 Limitations"
25 href="node791.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="19. Python compiler package"
28 href="compiler.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="19.3.1 AST Nodes"
31 href="module-compiler.ast.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="node791.html">19.2 Limitations</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="compiler.html">19. Python compiler package</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-compiler.ast.html">19.3.1 AST Nodes</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0021300000000000000000">
5619.3 Python Abstract Syntax</A>
57</H1>
58
59<P>
60The <tt class="module">compiler.ast</tt> module defines an abstract syntax for
61Python. In the abstract syntax tree, each node represents a syntactic
62construct. The root of the tree is <tt class="class">Module</tt> object.
63
64<P>
65The abstract syntax offers a higher level interface to parsed Python
66source code. The <a class="ulink" href="http://www.python.org/doc/current/lib/module-parser.html"
67 ><tt class="module">parser</tt></a>
68module and the compiler written in C for the Python interpreter use a
69concrete syntax tree. The concrete syntax is tied closely to the
70grammar description used for the Python parser. Instead of a single
71node for a construct, there are often several levels of nested nodes
72that are introduced by Python's precedence rules.
73
74<P>
75The abstract syntax tree is created by the
76<tt class="module">compiler.transformer</tt> module. The transformer relies on the
77builtin Python parser to generate a concrete syntax tree. It
78generates an abstract syntax tree from the concrete tree.
79
80<P>
81The <tt class="module">transformer</tt> module was created by Greg
82Stein<a id='l2h-5025' xml:id='l2h-5025'></a> and Bill Tutt<a id='l2h-5026' xml:id='l2h-5026'></a> for an
83experimental Python-to-C compiler. The current version contains a
84number of modifications and improvements, but the basic form of the
85abstract syntax and of the transformer are due to Stein and Tutt.
86
87<P>
88
89<p><br /></p><hr class='online-navigation' />
90<div class='online-navigation'>
91<!--Table of Child-Links-->
92<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
93
94<UL CLASS="ChildLinks">
95<LI><A href="module-compiler.ast.html">19.3.1 AST Nodes</a>
96<LI><A href="node794.html">19.3.2 Assignment nodes</a>
97<LI><A href="node795.html">19.3.3 Examples</a>
98</ul>
99<!--End of Table of Child-Links-->
100</div>
101
102<DIV CLASS="navigation">
103<div class='online-navigation'>
104<p></p><hr />
105<table align="center" width="100%" cellpadding="0" cellspacing="2">
106<tr>
107<td class='online-navigation'><a rel="prev" title="19.2 Limitations"
108 href="node791.html"><img src='../icons/previous.png'
109 border='0' height='32' alt='Previous Page' width='32' /></A></td>
110<td class='online-navigation'><a rel="parent" title="19. Python compiler package"
111 href="compiler.html"><img src='../icons/up.png'
112 border='0' height='32' alt='Up One Level' width='32' /></A></td>
113<td class='online-navigation'><a rel="next" title="19.3.1 AST Nodes"
114 href="module-compiler.ast.html"><img src='../icons/next.png'
115 border='0' height='32' alt='Next Page' width='32' /></A></td>
116<td align="center" width="100%">Python Library Reference</td>
117<td class='online-navigation'><a rel="contents" title="Table of Contents"
118 href="contents.html"><img src='../icons/contents.png'
119 border='0' height='32' alt='Contents' width='32' /></A></td>
120<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
121 border='0' height='32' alt='Module Index' width='32' /></a></td>
122<td class='online-navigation'><a rel="index" title="Index"
123 href="genindex.html"><img src='../icons/index.png'
124 border='0' height='32' alt='Index' width='32' /></A></td>
125</tr></table>
126<div class='online-navigation'>
127<b class="navlabel">Previous:</b>
128<a class="sectref" rel="prev" href="node791.html">19.2 Limitations</A>
129<b class="navlabel">Up:</b>
130<a class="sectref" rel="parent" href="compiler.html">19. Python compiler package</A>
131<b class="navlabel">Next:</b>
132<a class="sectref" rel="next" href="module-compiler.ast.html">19.3.1 AST Nodes</A>
133</div>
134</div>
135<hr />
136<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
137</DIV>
138<!--End of Navigation Panel-->
139<ADDRESS>
140See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
141</ADDRESS>
142</BODY>
143</HTML>