Eli Bendersky | ac5752b | 2012-02-03 06:31:23 +0200 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="utf-8" ?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 | <meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" /> |
| 7 | <title>pycparser v2.05</title> |
| 8 | <meta name="author" content="Eli Bendersky" /> |
| 9 | <style type="text/css"> |
| 10 | |
| 11 | /* |
| 12 | :Author: David Goodger (goodger@python.org) |
| 13 | :Id: $Id: html4css1.css 5951 2009-05-18 18:03:10Z milde $ |
| 14 | :Copyright: This stylesheet has been placed in the public domain. |
| 15 | |
| 16 | Default cascading style sheet for the HTML output of Docutils. |
| 17 | |
| 18 | See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to |
| 19 | customize this style sheet. |
| 20 | */ |
| 21 | |
| 22 | /* used to remove borders from tables and images */ |
| 23 | .borderless, table.borderless td, table.borderless th { |
| 24 | border: 0 } |
| 25 | |
| 26 | table.borderless td, table.borderless th { |
| 27 | /* Override padding for "table.docutils td" with "! important". |
| 28 | The right padding separates the table cells. */ |
| 29 | padding: 0 0.5em 0 0 ! important } |
| 30 | |
| 31 | .first { |
| 32 | /* Override more specific margin styles with "! important". */ |
| 33 | margin-top: 0 ! important } |
| 34 | |
| 35 | .last, .with-subtitle { |
| 36 | margin-bottom: 0 ! important } |
| 37 | |
| 38 | .hidden { |
| 39 | display: none } |
| 40 | |
| 41 | a.toc-backref { |
| 42 | text-decoration: none ; |
| 43 | color: black } |
| 44 | |
| 45 | blockquote.epigraph { |
| 46 | margin: 2em 5em ; } |
| 47 | |
| 48 | dl.docutils dd { |
| 49 | margin-bottom: 0.5em } |
| 50 | |
| 51 | /* Uncomment (and remove this text!) to get bold-faced definition list terms |
| 52 | dl.docutils dt { |
| 53 | font-weight: bold } |
| 54 | */ |
| 55 | |
| 56 | div.abstract { |
| 57 | margin: 2em 5em } |
| 58 | |
| 59 | div.abstract p.topic-title { |
| 60 | font-weight: bold ; |
| 61 | text-align: center } |
| 62 | |
| 63 | div.admonition, div.attention, div.caution, div.danger, div.error, |
| 64 | div.hint, div.important, div.note, div.tip, div.warning { |
| 65 | margin: 2em ; |
| 66 | border: medium outset ; |
| 67 | padding: 1em } |
| 68 | |
| 69 | div.admonition p.admonition-title, div.hint p.admonition-title, |
| 70 | div.important p.admonition-title, div.note p.admonition-title, |
| 71 | div.tip p.admonition-title { |
| 72 | font-weight: bold ; |
| 73 | font-family: sans-serif } |
| 74 | |
| 75 | div.attention p.admonition-title, div.caution p.admonition-title, |
| 76 | div.danger p.admonition-title, div.error p.admonition-title, |
| 77 | div.warning p.admonition-title { |
| 78 | color: red ; |
| 79 | font-weight: bold ; |
| 80 | font-family: sans-serif } |
| 81 | |
| 82 | /* Uncomment (and remove this text!) to get reduced vertical space in |
| 83 | compound paragraphs. |
| 84 | div.compound .compound-first, div.compound .compound-middle { |
| 85 | margin-bottom: 0.5em } |
| 86 | |
| 87 | div.compound .compound-last, div.compound .compound-middle { |
| 88 | margin-top: 0.5em } |
| 89 | */ |
| 90 | |
| 91 | div.dedication { |
| 92 | margin: 2em 5em ; |
| 93 | text-align: center ; |
| 94 | font-style: italic } |
| 95 | |
| 96 | div.dedication p.topic-title { |
| 97 | font-weight: bold ; |
| 98 | font-style: normal } |
| 99 | |
| 100 | div.figure { |
| 101 | margin-left: 2em ; |
| 102 | margin-right: 2em } |
| 103 | |
| 104 | div.footer, div.header { |
| 105 | clear: both; |
| 106 | font-size: smaller } |
| 107 | |
| 108 | div.line-block { |
| 109 | display: block ; |
| 110 | margin-top: 1em ; |
| 111 | margin-bottom: 1em } |
| 112 | |
| 113 | div.line-block div.line-block { |
| 114 | margin-top: 0 ; |
| 115 | margin-bottom: 0 ; |
| 116 | margin-left: 1.5em } |
| 117 | |
| 118 | div.sidebar { |
| 119 | margin: 0 0 0.5em 1em ; |
| 120 | border: medium outset ; |
| 121 | padding: 1em ; |
| 122 | background-color: #ffffee ; |
| 123 | width: 40% ; |
| 124 | float: right ; |
| 125 | clear: right } |
| 126 | |
| 127 | div.sidebar p.rubric { |
| 128 | font-family: sans-serif ; |
| 129 | font-size: medium } |
| 130 | |
| 131 | div.system-messages { |
| 132 | margin: 5em } |
| 133 | |
| 134 | div.system-messages h1 { |
| 135 | color: red } |
| 136 | |
| 137 | div.system-message { |
| 138 | border: medium outset ; |
| 139 | padding: 1em } |
| 140 | |
| 141 | div.system-message p.system-message-title { |
| 142 | color: red ; |
| 143 | font-weight: bold } |
| 144 | |
| 145 | div.topic { |
| 146 | margin: 2em } |
| 147 | |
| 148 | h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, |
| 149 | h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { |
| 150 | margin-top: 0.4em } |
| 151 | |
| 152 | h1.title { |
| 153 | text-align: center } |
| 154 | |
| 155 | h2.subtitle { |
| 156 | text-align: center } |
| 157 | |
| 158 | hr.docutils { |
| 159 | width: 75% } |
| 160 | |
| 161 | img.align-left, .figure.align-left{ |
| 162 | clear: left ; |
| 163 | float: left ; |
| 164 | margin-right: 1em } |
| 165 | |
| 166 | img.align-right, .figure.align-right { |
| 167 | clear: right ; |
| 168 | float: right ; |
| 169 | margin-left: 1em } |
| 170 | |
| 171 | .align-left { |
| 172 | text-align: left } |
| 173 | |
| 174 | .align-center { |
| 175 | clear: both ; |
| 176 | text-align: center } |
| 177 | |
| 178 | .align-right { |
| 179 | text-align: right } |
| 180 | |
| 181 | /* reset inner alignment in figures */ |
| 182 | div.align-right { |
| 183 | text-align: left } |
| 184 | |
| 185 | /* div.align-center * { */ |
| 186 | /* text-align: left } */ |
| 187 | |
| 188 | ol.simple, ul.simple { |
| 189 | margin-bottom: 1em } |
| 190 | |
| 191 | ol.arabic { |
| 192 | list-style: decimal } |
| 193 | |
| 194 | ol.loweralpha { |
| 195 | list-style: lower-alpha } |
| 196 | |
| 197 | ol.upperalpha { |
| 198 | list-style: upper-alpha } |
| 199 | |
| 200 | ol.lowerroman { |
| 201 | list-style: lower-roman } |
| 202 | |
| 203 | ol.upperroman { |
| 204 | list-style: upper-roman } |
| 205 | |
| 206 | p.attribution { |
| 207 | text-align: right ; |
| 208 | margin-left: 50% } |
| 209 | |
| 210 | p.caption { |
| 211 | font-style: italic } |
| 212 | |
| 213 | p.credits { |
| 214 | font-style: italic ; |
| 215 | font-size: smaller } |
| 216 | |
| 217 | p.label { |
| 218 | white-space: nowrap } |
| 219 | |
| 220 | p.rubric { |
| 221 | font-weight: bold ; |
| 222 | font-size: larger ; |
| 223 | color: maroon ; |
| 224 | text-align: center } |
| 225 | |
| 226 | p.sidebar-title { |
| 227 | font-family: sans-serif ; |
| 228 | font-weight: bold ; |
| 229 | font-size: larger } |
| 230 | |
| 231 | p.sidebar-subtitle { |
| 232 | font-family: sans-serif ; |
| 233 | font-weight: bold } |
| 234 | |
| 235 | p.topic-title { |
| 236 | font-weight: bold } |
| 237 | |
| 238 | pre.address { |
| 239 | margin-bottom: 0 ; |
| 240 | margin-top: 0 ; |
| 241 | font: inherit } |
| 242 | |
| 243 | pre.literal-block, pre.doctest-block { |
| 244 | margin-left: 2em ; |
| 245 | margin-right: 2em } |
| 246 | |
| 247 | span.classifier { |
| 248 | font-family: sans-serif ; |
| 249 | font-style: oblique } |
| 250 | |
| 251 | span.classifier-delimiter { |
| 252 | font-family: sans-serif ; |
| 253 | font-weight: bold } |
| 254 | |
| 255 | span.interpreted { |
| 256 | font-family: sans-serif } |
| 257 | |
| 258 | span.option { |
| 259 | white-space: nowrap } |
| 260 | |
| 261 | span.pre { |
| 262 | white-space: pre } |
| 263 | |
| 264 | span.problematic { |
| 265 | color: red } |
| 266 | |
| 267 | span.section-subtitle { |
| 268 | /* font-size relative to parent (h1..h6 element) */ |
| 269 | font-size: 80% } |
| 270 | |
| 271 | table.citation { |
| 272 | border-left: solid 1px gray; |
| 273 | margin-left: 1px } |
| 274 | |
| 275 | table.docinfo { |
| 276 | margin: 2em 4em } |
| 277 | |
| 278 | table.docutils { |
| 279 | margin-top: 0.5em ; |
| 280 | margin-bottom: 0.5em } |
| 281 | |
| 282 | table.footnote { |
| 283 | border-left: solid 1px black; |
| 284 | margin-left: 1px } |
| 285 | |
| 286 | table.docutils td, table.docutils th, |
| 287 | table.docinfo td, table.docinfo th { |
| 288 | padding-left: 0.5em ; |
| 289 | padding-right: 0.5em ; |
| 290 | vertical-align: top } |
| 291 | |
| 292 | table.docutils th.field-name, table.docinfo th.docinfo-name { |
| 293 | font-weight: bold ; |
| 294 | text-align: left ; |
| 295 | white-space: nowrap ; |
| 296 | padding-left: 0 } |
| 297 | |
| 298 | h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, |
| 299 | h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { |
| 300 | font-size: 100% } |
| 301 | |
| 302 | ul.auto-toc { |
| 303 | list-style-type: none } |
| 304 | |
| 305 | </style> |
| 306 | </head> |
| 307 | <body> |
| 308 | <div class="document" id="pycparser-v2-05"> |
| 309 | <h1 class="title">pycparser v2.05</h1> |
| 310 | <table class="docinfo" frame="void" rules="none"> |
| 311 | <col class="docinfo-name" /> |
| 312 | <col class="docinfo-content" /> |
| 313 | <tbody valign="top"> |
| 314 | <tr><th class="docinfo-name">Author:</th> |
| 315 | <td><a class="first reference external" href="http://eli.thegreenplace.net">Eli Bendersky</a></td></tr> |
| 316 | </tbody> |
| 317 | </table> |
| 318 | <div class="contents topic" id="contents"> |
| 319 | <p class="topic-title first">Contents</p> |
| 320 | <ul class="auto-toc simple"> |
| 321 | <li><a class="reference internal" href="#introduction" id="id2">1 Introduction</a><ul class="auto-toc"> |
| 322 | <li><a class="reference internal" href="#what-is-pycparser" id="id3">1.1 What is pycparser?</a></li> |
| 323 | <li><a class="reference internal" href="#what-is-it-good-for" id="id4">1.2 What is it good for?</a></li> |
| 324 | <li><a class="reference internal" href="#which-version-of-c-does-pycparser-support" id="id5">1.3 Which version of C does pycparser support?</a></li> |
| 325 | <li><a class="reference internal" href="#what-grammar-does-pycparser-follow" id="id6">1.4 What grammar does pycparser follow?</a></li> |
| 326 | <li><a class="reference internal" href="#how-is-pycparser-licensed" id="id7">1.5 How is pycparser licensed?</a></li> |
| 327 | <li><a class="reference internal" href="#contact-details" id="id8">1.6 Contact details</a></li> |
| 328 | </ul> |
| 329 | </li> |
| 330 | <li><a class="reference internal" href="#installing" id="id9">2 Installing</a><ul class="auto-toc"> |
| 331 | <li><a class="reference internal" href="#prerequisites" id="id10">2.1 Prerequisites</a></li> |
| 332 | <li><a class="reference internal" href="#installation-process" id="id11">2.2 Installation process</a></li> |
| 333 | <li><a class="reference internal" href="#known-problems" id="id12">2.3 Known problems</a></li> |
| 334 | </ul> |
| 335 | </li> |
| 336 | <li><a class="reference internal" href="#using" id="id13">3 Using</a><ul class="auto-toc"> |
| 337 | <li><a class="reference internal" href="#interaction-with-the-c-preprocessor" id="id14">3.1 Interaction with the C preprocessor</a></li> |
| 338 | <li><a class="reference internal" href="#what-about-the-standard-c-library-headers" id="id15">3.2 What about the standard C library headers?</a></li> |
| 339 | <li><a class="reference internal" href="#basic-usage" id="id16">3.3 Basic usage</a></li> |
| 340 | <li><a class="reference internal" href="#advanced-usage" id="id17">3.4 Advanced usage</a></li> |
| 341 | </ul> |
| 342 | </li> |
| 343 | <li><a class="reference internal" href="#modifying" id="id18">4 Modifying</a></li> |
| 344 | <li><a class="reference internal" href="#package-contents" id="id19">5 Package contents</a></li> |
| 345 | <li><a class="reference internal" href="#contributors" id="id20">6 Contributors</a></li> |
| 346 | <li><a class="reference internal" href="#changelog" id="id21">7 Changelog</a></li> |
| 347 | </ul> |
| 348 | </div> |
| 349 | <div class="section" id="introduction"> |
| 350 | <h1>1 Introduction</h1> |
| 351 | <div class="section" id="what-is-pycparser"> |
| 352 | <h2>1.1 What is pycparser?</h2> |
| 353 | <p><tt class="docutils literal">pycparser</tt> is a parser for the C language, written in pure Python. It is a module designed to be easily integrated into applications that need to parse C source code.</p> |
| 354 | </div> |
| 355 | <div class="section" id="what-is-it-good-for"> |
| 356 | <h2>1.2 What is it good for?</h2> |
| 357 | <p>Anything that needs C code to be parsed. The following are some uses for <tt class="docutils literal">pycparser</tt>, taken from real user reports:</p> |
| 358 | <ul class="simple"> |
| 359 | <li>C code obfuscator</li> |
| 360 | <li>Front-end for various specialized C compilers</li> |
| 361 | <li>Static code checker</li> |
| 362 | <li>Automatic unit-test discovery</li> |
| 363 | <li>Adding specialized extensions to the C language</li> |
| 364 | </ul> |
| 365 | <p><tt class="docutils literal">pycparser</tt> is unique in the sense that it's written in pure Python - a very high level language that's easy to experiment with and tweak. To people familiar with Lex and Yacc, <tt class="docutils literal">pycparser</tt>'s code will be simple to understand.</p> |
| 366 | </div> |
| 367 | <div class="section" id="which-version-of-c-does-pycparser-support"> |
| 368 | <h2>1.3 Which version of C does pycparser support?</h2> |
| 369 | <p><tt class="docutils literal">pycparser</tt> aims to support the full C99 language (according to the standard ISO/IEC 9899). This is a new feature in the version 2.x series - earlier versions only supported C89. For more information on the change, read <a class="reference external" href="http://code.google.com/p/pycparser/wiki/C99support">this wiki page</a>.</p> |
| 370 | <p><tt class="docutils literal">pycparser</tt> doesn't support any GCC extensions.</p> |
| 371 | </div> |
| 372 | <div class="section" id="what-grammar-does-pycparser-follow"> |
| 373 | <h2>1.4 What grammar does pycparser follow?</h2> |
| 374 | <p><tt class="docutils literal">pycparser</tt> very closely follows the C grammar provided in the end of the C99 standard document</p> |
| 375 | </div> |
| 376 | <div class="section" id="how-is-pycparser-licensed"> |
| 377 | <h2>1.5 How is pycparser licensed?</h2> |
| 378 | <p><a class="reference external" href="http://www.opensource.org/licenses/bsd-license.php">New BSD License</a></p> |
| 379 | </div> |
| 380 | <div class="section" id="contact-details"> |
| 381 | <h2>1.6 Contact details</h2> |
| 382 | <p>Drop me an email to <a class="reference external" href="mailto:eliben@gmail.com">eliben@gmail.com</a> for any questions regarding <tt class="docutils literal">pycparser</tt>. For reporting problems with <tt class="docutils literal">pycparser</tt> or submitting feature requests, the best way is to open an issue on the <a class="reference external" href="http://code.google.com/p/pycparser/">pycparser page at Google Code</a>.</p> |
| 383 | </div> |
| 384 | </div> |
| 385 | <div class="section" id="installing"> |
| 386 | <h1>2 Installing</h1> |
| 387 | <div class="section" id="prerequisites"> |
| 388 | <h2>2.1 Prerequisites</h2> |
| 389 | <ul class="simple"> |
| 390 | <li><tt class="docutils literal">pycparser</tt> was tested on Python 2.6 and 3.2, on both Linux and Windows. It should work on any later version (in both the 2.x and 3.x lines) as well.</li> |
| 391 | <li><tt class="docutils literal">pycparser</tt> uses the PLY module for the actual lexer and parser construction. Install PLY from <a class="reference external" href="http://www.dabeaz.com/ply/">its website</a>.</li> |
| 392 | </ul> |
| 393 | </div> |
| 394 | <div class="section" id="installation-process"> |
| 395 | <h2>2.2 Installation process</h2> |
| 396 | <p>Installing <tt class="docutils literal">pycparser</tt> is very simple. Once you download it from its <a class="reference external" href="http://code.google.com/p/pycparser/">website</a> and unzip the package, you just have to execute the standard <tt class="docutils literal">python setup.py install</tt>. The setup script will then place the <tt class="docutils literal">pycparser</tt> module into <tt class="docutils literal"><span class="pre">site-packages</span></tt> in your Python's installation library.</p> |
| 397 | <p>Alternatively, since <tt class="docutils literal">pycparser</tt> is listed in the <a class="reference external" href="http://pypi.python.org/pypi/pycparser">Python Package Index</a> (PyPI), you can install it using your favorite Python packaging/distribution tool, for example with:</p> |
| 398 | <pre class="literal-block"> |
| 399 | > pip install pycparser |
| 400 | </pre> |
| 401 | <p>It's recommended to run <tt class="docutils literal">_build_tables.py</tt> in the <tt class="docutils literal">pycparser</tt> code directory after installation to make sure the parsing tables of PLY are pre-generated. This can make your code run faster.</p> |
| 402 | </div> |
| 403 | <div class="section" id="known-problems"> |
| 404 | <h2>2.3 Known problems</h2> |
| 405 | <ul class="simple"> |
| 406 | <li>Some users who've installed a new version of <tt class="docutils literal">pycparser</tt> over an existing version ran into a problem using the newly installed library. This has to do with parse tables staying around as <tt class="docutils literal">.pyc</tt> files from the older version. If you see unexplained errors from <tt class="docutils literal">pycparser</tt> after an upgrade, remove it (by deleting the <tt class="docutils literal">pycparser</tt> directory in your Python's <tt class="docutils literal"><span class="pre">site-packages</span></tt>, or wherever you installed it) and install again.</li> |
| 407 | </ul> |
| 408 | </div> |
| 409 | </div> |
| 410 | <div class="section" id="using"> |
| 411 | <h1>3 Using</h1> |
| 412 | <div class="section" id="interaction-with-the-c-preprocessor"> |
| 413 | <h2>3.1 Interaction with the C preprocessor</h2> |
| 414 | <p>In order to be compilable, C code must be preprocessed by the C preprocessor - <tt class="docutils literal">cpp</tt>. <tt class="docutils literal">cpp</tt> handles preprocessing directives like <tt class="docutils literal">#include</tt> and <tt class="docutils literal">#define</tt>, removes comments, and does other minor tasks that prepare the C code for compilation.</p> |
| 415 | <p>For all but the most trivial snippets of C code, <tt class="docutils literal">pycparser</tt>, like a C compiler, must receive preprocessed C code in order to function correctly. If you import the top-level <tt class="docutils literal">parse_file</tt> function from the <tt class="docutils literal">pycparser</tt> package, it will interact with <tt class="docutils literal">cpp</tt> for you, as long as it's in your PATH, or you provide a path to it.</p> |
| 416 | <p>On the vast majority of Linux systems, <tt class="docutils literal">cpp</tt> is installed and is in the PATH. If you're on Windows and don't have <tt class="docutils literal">cpp</tt> somewhere, you can use the one provided in the <tt class="docutils literal">utils</tt> directory in <tt class="docutils literal">pycparser</tt>'s distribution. This <tt class="docutils literal">cpp</tt> executable was compiled from the <a class="reference external" href="http://www.cs.princeton.edu/software/lcc/">LCC distribution</a>, and is provided under LCC's license terms.</p> |
| 417 | </div> |
| 418 | <div class="section" id="what-about-the-standard-c-library-headers"> |
| 419 | <h2>3.2 What about the standard C library headers?</h2> |
| 420 | <p>C code almost always includes various header files from the standard C library, like <tt class="docutils literal">stdio.h</tt>. While, with some effort, <tt class="docutils literal">pycparser</tt> can be made to parse the standard headers from any C compiler, it's much simpler to use the provided "fake" standard includes in <tt class="docutils literal">utils/fake_libc_include</tt>. These are standard C header files that contain only the bare necessities to allow valid parsing of the files that use them. As a bonus, since they're minimal, it can significantly improve the performance of parsing C files.</p> |
| 421 | <p>See the <tt class="docutils literal">using_cpp_libc.py</tt> example for more details.</p> |
| 422 | </div> |
| 423 | <div class="section" id="basic-usage"> |
| 424 | <h2>3.3 Basic usage</h2> |
| 425 | <p>Take a look at the <tt class="docutils literal">examples</tt> directory of the distribution for a few examples of using <tt class="docutils literal">pycparser</tt>. These should be enough to get you started.</p> |
| 426 | </div> |
| 427 | <div class="section" id="advanced-usage"> |
| 428 | <h2>3.4 Advanced usage</h2> |
| 429 | <p>The public interface of <tt class="docutils literal">pycparser</tt> is well documented with comments in <tt class="docutils literal">pycparser/c_parser.py</tt>. For a detailed overview of the various AST nodes created by the parser, see <tt class="docutils literal">pycparser/_c_ast.cfg</tt>.</p> |
| 430 | <p>There's also a <a class="reference external" href="http://code.google.com/p/pycparser/wiki/FAQ">FAQ available here</a>. In any case, you can always drop me an <a class="reference external" href="mailto:eliben@gmail.com">email</a> for help.</p> |
| 431 | </div> |
| 432 | </div> |
| 433 | <div class="section" id="modifying"> |
| 434 | <h1>4 Modifying</h1> |
| 435 | <p>There are a few points to keep in mind when modifying <tt class="docutils literal">pycparser</tt>:</p> |
| 436 | <ul class="simple"> |
| 437 | <li>The code for <tt class="docutils literal">pycparser</tt>'s AST nodes is automatically generated from a configuration file - <tt class="docutils literal">_c_ast.cfg</tt>, by <tt class="docutils literal">_ast_gen.py</tt>. If you modify the AST configuration, make sure to re-generate the code.</li> |
| 438 | <li>Make sure you understand the optimized mode of <tt class="docutils literal">pycparser</tt> - for that you must read the docstring in the constructor of the <tt class="docutils literal">CParser</tt> class. For development you should create the parser without optimizations, so that it will regenerate the Yacc and Lex tables when you change the grammar.</li> |
| 439 | </ul> |
| 440 | </div> |
| 441 | <div class="section" id="package-contents"> |
| 442 | <h1>5 Package contents</h1> |
| 443 | <p>Once you unzip the <tt class="docutils literal">pycparser</tt> package, you'll see the following files and directories:</p> |
| 444 | <dl class="docutils"> |
| 445 | <dt>README.txt/html:</dt> |
| 446 | <dd>This README file.</dd> |
| 447 | <dt>setup.py:</dt> |
| 448 | <dd>Installation script</dd> |
| 449 | <dt>examples/:</dt> |
| 450 | <dd>A directory with some examples of using <tt class="docutils literal">pycparser</tt></dd> |
| 451 | <dt>pycparser/:</dt> |
| 452 | <dd>The <tt class="docutils literal">pycparser</tt> module source code.</dd> |
| 453 | <dt>tests/:</dt> |
| 454 | <dd>Unit tests.</dd> |
| 455 | <dt>utils/cpp.exe:</dt> |
| 456 | <dd>A Windows executable of the C pre-processor suitable for working with pycparser</dd> |
| 457 | <dt>utils/fake_libc_include:</dt> |
| 458 | <dd>Minimal standard C library include files that should allow to parse any C code.</dd> |
| 459 | <dt>utils/internal/:</dt> |
| 460 | <dd>Internal utilities for my own use. You probably don't need them.</dd> |
| 461 | </dl> |
| 462 | </div> |
| 463 | <div class="section" id="contributors"> |
| 464 | <h1>6 Contributors</h1> |
| 465 | <p>Some people have contributed to <tt class="docutils literal">pycparser</tt> by opening issues on bugs they've found and/or submitting patches. The list of contributors is at <a class="reference external" href="http://code.google.com/p/pycparser/wiki/Contributors">this pycparser Wiki page</a>.</p> |
| 466 | </div> |
| 467 | <div class="section" id="changelog"> |
| 468 | <h1>7 Changelog</h1> |
| 469 | <ul class="simple"> |
| 470 | <li>Version 2.06 (??)<ul> |
| 471 | <li>Issue 48: gracefully handle parsing of empty files</li> |
| 472 | <li>Issues 49 & 50: handle more escaped chars in paths to #line - "....test.h".</li> |
| 473 | <li>Support for C99 _Complex type.</li> |
| 474 | <li>CGenerator moves from examples/ to pycparser/ as a first-class citizen, and |
| 475 | added some fixes to it. examples/c-to-c.py still stays as a convenience |
| 476 | wrapper.</li> |
| 477 | <li>Fix problem with parsing a file in which the first statement is just a |
| 478 | semicolon.</li> |
| 479 | </ul> |
| 480 | </li> |
| 481 | <li>Version 2.05 (16.10.2011)<ul> |
| 482 | <li>Added support for the C99 <tt class="docutils literal">_Bool</tt> type and <tt class="docutils literal">stdbool.h</tt> header file</li> |
| 483 | <li>Expanded <tt class="docutils literal">examples/explore_ast.py</tt> with more details on working with the |
| 484 | AST</li> |
| 485 | <li>Relaxed the rules on parsing unnamed struct members (helps parse <tt class="docutils literal">windows.h</tt>)</li> |
| 486 | <li>Bug fixes:<ul> |
| 487 | <li>Fixed spacing issue for some type declarations</li> |
| 488 | <li>Issue 47: display empty statements (lone ';') correctly after parsing</li> |
| 489 | </ul> |
| 490 | </li> |
| 491 | </ul> |
| 492 | </li> |
| 493 | <li>Version 2.04 (21.05.2011)<ul> |
| 494 | <li>License changed from LGPL to BSD</li> |
| 495 | <li>Bug fixes:<ul> |
| 496 | <li>Issue 31: constraining the scope of typedef definitions</li> |
| 497 | <li>Issues 33, 35: fixes for the c-to-c.py example</li> |
| 498 | </ul> |
| 499 | </li> |
| 500 | <li>Added C99 integer types to fake headers</li> |
| 501 | <li>Added unit tests for the c-to-c.py example</li> |
| 502 | </ul> |
| 503 | </li> |
| 504 | <li>Version 2.03 (06.03.2011)<ul> |
| 505 | <li>Bug fixes:<ul> |
| 506 | <li>Issue 17: empty file-level declarations</li> |
| 507 | <li>Issue 18: empty statements and declarations in functions</li> |
| 508 | <li>Issue 19: anonymous structs & union fields</li> |
| 509 | <li>Issue 23: fix coordinates of Cast nodes</li> |
| 510 | </ul> |
| 511 | </li> |
| 512 | <li>New example added (<tt class="docutils literal"><span class="pre">examples/c-to-c.py</span></tt>) for translating ASTs generated by <tt class="docutils literal">pycparser</tt> back into C code.</li> |
| 513 | <li><tt class="docutils literal">pycparser</tt> is now on PyPI (Python Package Index)</li> |
| 514 | <li>Created <a class="reference external" href="http://code.google.com/p/pycparser/wiki/FAQ">FAQ</a> on the <tt class="docutils literal">pycparser</tt> project page</li> |
| 515 | <li>Removed support for Python 2.5. <tt class="docutils literal">pycparser</tt> supports Python 2 from 2.6 and on, and Python 3.</li> |
| 516 | </ul> |
| 517 | </li> |
| 518 | <li>Version 2.02 (10.12.2010)<ul> |
| 519 | <li>The name of a <tt class="docutils literal">NamedInitializer</tt> node was turned into a sequence of nodes |
| 520 | instead of an attribute, to make it discoverable by the AST node visitor.</li> |
| 521 | <li>Documentation updates</li> |
| 522 | </ul> |
| 523 | </li> |
| 524 | <li>Version 2.01 (04.12.2010)<ul> |
| 525 | <li>Removed dependency on YAML. Parsing of the AST node configuration file is done with a simple parser.</li> |
| 526 | <li>Fixed issue 12: installation problems</li> |
| 527 | </ul> |
| 528 | </li> |
| 529 | <li>Version 2.00 (31.10.2010)<ul> |
| 530 | <li>Support for C99 (read <a class="reference external" href="http://code.google.com/p/pycparser/wiki/C99support">this wiki page</a> for more information).</li> |
| 531 | </ul> |
| 532 | </li> |
| 533 | <li>Version 1.08 (09.10.2010)<ul> |
| 534 | <li>Bug fixes:<ul> |
| 535 | <li>Correct handling of <tt class="docutils literal">do{} ... while</tt> statements in some cases</li> |
| 536 | <li>Issues 6 & 7: Concatenation of string literals</li> |
| 537 | <li>Issue 9: Support for unnamed bitfields in structs</li> |
| 538 | </ul> |
| 539 | </li> |
| 540 | </ul> |
| 541 | </li> |
| 542 | <li>Version 1.07 (18.05.2010)<ul> |
| 543 | <li>Python 3.1 compatibility: <tt class="docutils literal">pycparser</tt> was modified to run on Python 3.1 as well as 2.6</li> |
| 544 | </ul> |
| 545 | </li> |
| 546 | <li>Version 1.06 (10.04.2010)<ul> |
| 547 | <li>Bug fixes:<ul> |
| 548 | <li>coord not propagated to FuncCall nodes</li> |
| 549 | <li>lexing of the ^= token (XOREQUALS)</li> |
| 550 | <li>parsing failed on some abstract declarator rules</li> |
| 551 | </ul> |
| 552 | </li> |
| 553 | <li>Linux compatibility: fixed end-of-line and <tt class="docutils literal">cpp</tt> path issues to allow all tests and examples run on Linux</li> |
| 554 | </ul> |
| 555 | </li> |
| 556 | <li>Version 1.05 (16.10.2009)<ul> |
| 557 | <li>Fixed the <tt class="docutils literal">parse_file</tt> auxiliary function to handle multiple arguments to <tt class="docutils literal">cpp</tt> correctly</li> |
| 558 | </ul> |
| 559 | </li> |
| 560 | <li>Version 1.04 (22.05.2009)<ul> |
| 561 | <li>Added the <tt class="docutils literal">fake_libc_include</tt> directory to allow parsing of C code that uses standard C library include files without dependency on a real C library.</li> |
| 562 | <li>Tested with Python 2.6 and PLY 3.2</li> |
| 563 | </ul> |
| 564 | </li> |
| 565 | <li>Version 1.03 (31.01.2009)<ul> |
| 566 | <li>Accept enumeration lists with a comma after the last item (C99 feature).</li> |
| 567 | </ul> |
| 568 | </li> |
| 569 | <li>Version 1.02 (16.01.2009)<ul> |
| 570 | <li>Fixed problem of parsing struct/enum/union names that were named similarly to previously defined <tt class="docutils literal">typedef</tt> types.</li> |
| 571 | </ul> |
| 572 | </li> |
| 573 | <li>Version 1.01 (09.01.2009)<ul> |
| 574 | <li>Fixed subprocess invocation in the helper function parse_file - now it's more portable</li> |
| 575 | </ul> |
| 576 | </li> |
| 577 | <li>Version 1.0 (15.11.2008)<ul> |
| 578 | <li>Initial release</li> |
| 579 | <li>Support for ANSI C89</li> |
| 580 | </ul> |
| 581 | </li> |
| 582 | </ul> |
| 583 | </div> |
| 584 | </div> |
| 585 | </body> |
| 586 | </html> |