Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 7d6ec7e48acc4174ff52fc0ff2a40df4 > files > 2739

antlr3-C-docs-3.4-23.mga4.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>ANTLR3C: How to build Generated C Code</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ANTLR3C
   &#160;<span id="projectnumber">3.3.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('buildrec.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">How to build Generated C Code </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="generated"></a>
Generated Files</h1>
<p>The antlr tool jar, run against a grammar file that targets the C language, will generate the following files according to whether your grammar file contains a lexer, parser, combined or treeparser specification. Your grammar file name and the subject of the grammar line in your file are expected to match. Here the generic name G is used:</p>
<table class="doxtable">
<tr>
<th>Suffix  </th><th>Generated files   </th></tr>
<tr>
<td>lexer grammar (G.g3l)  </td><td>GLexer.c GLexer.h  </td></tr>
<tr>
<td>parser grammar (G.g3p)  </td><td>GParser.c GParser.h   </td></tr>
<tr>
<td>grammar G (G.g3pl)  </td><td>GParser.c GParser.h GLexer.c GLexer.h  </td></tr>
<tr>
<td>tree grammar G; (G.g3t)  </td><td>G.c G.h   </td></tr>
</table>
<p>The generated .c files reference the .h files using &lt;G.h&gt;, so you must use <code>-I.</code> on your compiler command line (or include the current directory in your include paths in Visual Studio). Additionally, the generated .h files reference <code><a class="el" href="antlr3_8h.html">antlr3.h</a></code>, so you must use <code>-I/path/to/antlr/include</code> (E.g. <code>-I /usr/local/include</code>) to reference the standard ANTLR include files.</p>
<p>In order to reference the library file at compile time (you can/should only reference one) you need to use the <code>-L/path/to/antlr/lib</code> (E.g. <code>-L /usr/local/lib</code>) on Unix, or add the path to your "Additional Library Path" in Visual Studio. You also need to specify the library using <code>-L</code> on Unix (E.g. <code>-L /usr/local/lib -l antlr3c</code>) or add <code>antlr3c_dll.lib</code> to your Additional Library Dependencies in Visual Studio.</p>
<p>In case it isn't obvious, the generated files may be used to produce either a library or an executable (.EXE on Windows) file.</p>
<p>If you use the shared version of the libraries, DLL or .so/.so/.a then you must ship the library with your application must run in an environment whereby the library can be found by the runtime linker/loader. This usually involves specifying the directory in which the library lives to an environment variable. On Windows, X:{yourwininstalldir} will be searched automatically.</p>
<h1><a class="anchor" id="invoke"></a>
Invoking Your Generated Recognizer</h1>
<p>In order to run your lexer/parser/tree parser combination, you will need a small function (or main) function that controls the sequence of events, from reading the input file or string, through to invoking the tree parser(s) and retrieving the results. See "Using the ANTLR3C C Target" for more detailed instructions, but if you just want to get going as fast as possible, study the following code example.</p>
<div class="fragment"><div class="line">* </div>
<div class="line">*  <span class="comment">// You may adopt your own practices by all means, but in general it is best</span></div>
<div class="line">*  <span class="comment">// to create a single include for your project, that will include the ANTLR3 C</span></div>
<div class="line">*  <span class="comment">// runtime header files, the generated header files (all of which are safe to include</span></div>
<div class="line">*  <span class="comment">// multiple times) and your own project related header files. Use &lt;&gt; to include and</span></div>
<div class="line">*  <span class="comment">// -I on the compile line (which vs2005 now handles, where vs2003 did not).</span></div>
<div class="line">*  <span class="comment">//</span></div>
<div class="line">*  #include    &lt;treeparser.h&gt;</div>
<div class="line">*  </div>
<div class="line">*  <span class="comment">// Main entry point for this example</span></div>
<div class="line">*  <span class="comment">//</span></div>
<div class="line">*  <span class="keywordtype">int</span> <a class="code" href="antlr3defs_8h.html#a91c919dd260a95cc88a0cd9b5c0a11cc">ANTLR3_CDECL</a></div>
<div class="line">*  main (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[])</div>
<div class="line">*  {</div>
<div class="line">*      <span class="comment">// Now we declare the ANTLR related local variables we need.</span></div>
<div class="line">*      <span class="comment">// Note that unless you are convinced you will never need thread safe</span></div>
<div class="line">*      <span class="comment">// versions for your project, then you should always create such things</span></div>
<div class="line">*      <span class="comment">// as instance variables for each invocation.</span></div>
<div class="line">*      <span class="comment">// -------------------</span></div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Name of the input file. Note that we always use the abstract type pANTLR3_UINT8</span></div>
<div class="line">*      <span class="comment">// for ASCII/8 bit strings - the runtime library guarantees that this will be</span></div>
<div class="line">*      <span class="comment">// good on all platforms. This is a general rule - always use the ANTLR3 supplied</span></div>
<div class="line">*      <span class="comment">// typedefs for pointers/types/etc.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <a class="code" href="antlr3defs_8h.html#a95c800abcac5d607fd9e3e775ace78c5">pANTLR3_UINT8</a>        fName;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The ANTLR3 character input stream, which abstracts the input source such that</span></div>
<div class="line">*      <span class="comment">// it is easy to privide inpput from different sources such as files, or </span></div>
<div class="line">*      <span class="comment">// memory strings.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// For an 8Bit/latin-1/etc memory string use:</span></div>
<div class="line">*      <span class="comment">//       input = antlr3New8BitStringInPlaceStream (stringtouse, (ANTLR3_UINT32) length, NULL);</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// For a UTF16 memory string use:</span></div>
<div class="line">*      <span class="comment">//       input = antlr3NewUTF16StringInPlaceStream (stringtouse, (ANTLR3_UINT32) length, NULL);</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// For input from a file, see code below</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// Note that this is essentially a pointer to a structure containing pointers to functions.</span></div>
<div class="line">*      <span class="comment">// You can create your own input stream type (copy one of the existing ones) and override any</span></div>
<div class="line">*      <span class="comment">// individual function by installing your own pointer after you have created the standard </span></div>
<div class="line">*      <span class="comment">// version.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <a class="code" href="struct_a_n_t_l_r3___i_n_p_u_t___s_t_r_e_a_m__struct.html">pANTLR3_INPUT_STREAM</a>     input;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The lexer is of course generated by ANTLR, and so the lexer type is not upper case.</span></div>
<div class="line">*      <span class="comment">// The lexer is supplied with a pANTLR3_INPUT_STREAM from whence it consumes its</span></div>
<div class="line">*      <span class="comment">// input and generates a token stream as output. This is the ctx (CTX macro) pointer</span></div>
<div class="line">*       <span class="comment">// for your lexer.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      pLangLexer               lxr;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The token stream is produced by the ANTLR3 generated lexer. Again it is a structure based</span></div>
<div class="line">*      <span class="comment">// API/Object, which you can customise and override methods of as you wish. a Token stream is</span></div>
<div class="line">*      <span class="comment">// supplied to the generated parser, and you can write your own token stream and pass this in</span></div>
<div class="line">*      <span class="comment">// if you wish.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_o_k_e_n___s_t_r_e_a_m__struct.html">pANTLR3_COMMON_TOKEN_STREAM</a>      tstream;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The Lang parser is also generated by ANTLR and accepts a token stream as explained</span></div>
<div class="line">*      <span class="comment">// above. The token stream can be any source in fact, so long as it implements the </span></div>
<div class="line">*      <span class="comment">// ANTLR3_TOKEN_SOURCE interface. In this case the parser does not return anything</span></div>
<div class="line">*      <span class="comment">// but it can of course specify any kind of return type from the rule you invoke</span></div>
<div class="line">*      <span class="comment">// when calling it. This is the ctx (CTX macro) pointer for your parser.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      pLangParser              psr;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The parser produces an AST, which is returned as a member of the return type of</span></div>
<div class="line">*      <span class="comment">// the starting rule (any rule can start first of course). This is a generated type</span></div>
<div class="line">*      <span class="comment">// based upon the rule we start with.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      LangParser_decl_return       langAST;</div>
<div class="line">*  </div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The tree nodes are managed by a tree adaptor, which doles</span></div>
<div class="line">*      <span class="comment">// out the nodes upon request. You can make your own tree types and adaptors</span></div>
<div class="line">*      <span class="comment">// and override the built in versions. See runtime source for details and</span></div>
<div class="line">*      <span class="comment">// eventually the wiki entry for the C target.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_r_e_e___n_o_d_e___s_t_r_e_a_m__struct.html">pANTLR3_COMMON_TREE_NODE_STREAM</a>  nodes;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Finally, when the parser runs, it will produce an AST that can be traversed by the </span></div>
<div class="line">*      <span class="comment">// the tree parser: c.f. LangDumpDecl.g3t This is the ctx (CTX macro) pointer for your</span></div>
<div class="line">*       <span class="comment">// tree parser.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      pLangDumpDecl            treePsr;</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Create the input stream based upon the argument supplied to us on the command line</span></div>
<div class="line">*      <span class="comment">// for this example, the input will always default to ./input if there is no explicit</span></div>
<div class="line">*      <span class="comment">// argument.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*   <span class="keywordflow">if</span> (argc &lt; 2 || argv[1] == NULL)</div>
<div class="line">*   {</div>
<div class="line">*       fName   =(<a class="code" href="antlr3defs_8h.html#a95c800abcac5d607fd9e3e775ace78c5">pANTLR3_UINT8</a>)<span class="stringliteral">&quot;./input&quot;</span>; <span class="comment">// Note in VS2005 debug, working directory must be configured</span></div>
<div class="line">*   }</div>
<div class="line">*   <span class="keywordflow">else</span></div>
<div class="line">*   {</div>
<div class="line">*       fName   = (<a class="code" href="antlr3defs_8h.html#a95c800abcac5d607fd9e3e775ace78c5">pANTLR3_UINT8</a>)argv[1];</div>
<div class="line">*   }</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Create the input stream using the supplied file name</span></div>
<div class="line">*      <span class="comment">// (Use antlr38BitFileStreamNew for UTF16 input).</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      input    = antlr38BitFileStreamNew(fName);</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// The input will be created successfully, providing that there is enough</span></div>
<div class="line">*      <span class="comment">// memory and the file exists etc</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="keywordflow">if</span> ( input == NULL )</div>
<div class="line">*      {</div>
<div class="line">*           <a class="code" href="antlr3defs_8h.html#a27cc6fe6e2b9ed95c34ccbcf85149361">ANTLR3_FPRINTF</a>(stderr, <span class="stringliteral">&quot;Unable to open file %s due to malloc() failure1\n&quot;</span>, (<span class="keywordtype">char</span> *)fName);</div>
<div class="line">*      }</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Our input stream is now open and all set to go, so we can create a new instance of our</span></div>
<div class="line">*      <span class="comment">// lexer and set the lexer input to our input stream:</span></div>
<div class="line">*      <span class="comment">//  (file | memory | ?) --&gt; inputstream -&gt; lexer --&gt; tokenstream --&gt; parser ( --&gt; treeparser )?</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      lxr      = LangLexerNew(input);      <span class="comment">// CLexerNew is generated by ANTLR</span></div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Need to check for errors</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="keywordflow">if</span> ( lxr == NULL )</div>
<div class="line">*      {</div>
<div class="line">*           <a class="code" href="antlr3defs_8h.html#a27cc6fe6e2b9ed95c34ccbcf85149361">ANTLR3_FPRINTF</a>(stderr, <span class="stringliteral">&quot;Unable to create the lexer due to malloc() failure1\n&quot;</span>);</div>
<div class="line">*           exit(<a class="code" href="antlr3errors_8h.html#abbdcaff3e5d4da9691443e7ecdb671bf">ANTLR3_ERR_NOMEM</a>);</div>
<div class="line">*      }</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Our lexer is in place, so we can create the token stream from it</span></div>
<div class="line">*      <span class="comment">// NB: Nothing happens yet other than the file has been read. We are just </span></div>
<div class="line">*      <span class="comment">// connecting all these things together and they will be invoked when we</span></div>
<div class="line">*      <span class="comment">// call the parser rule. ANTLR3_SIZE_HINT can be left at the default usually</span></div>
<div class="line">*      <span class="comment">// unless you have a very large token stream/input. Each generated lexer</span></div>
<div class="line">*      <span class="comment">// provides a token source interface, which is the second argument to the</span></div>
<div class="line">*      <span class="comment">// token stream creator.</span></div>
<div class="line">*      <span class="comment">// Note tha even if you implement your own token structure, it will always</span></div>
<div class="line">*      <span class="comment">// contain a standard common token within it and this is the pointer that</span></div>
<div class="line">*      <span class="comment">// you pass around to everything else. A common token as a pointer within</span></div>
<div class="line">*      <span class="comment">// it that should point to your own outer token structure.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      tstream = <a class="code" href="antlr3tokenstream_8c.html#ad4ef5baa73e1fdd0f0c2fc4cce4277cb">antlr3CommonTokenStreamSourceNew</a>(<a class="code" href="antlr3defs_8h.html#a0f089eaab6993865d3d5daab26f8db98">ANTLR3_SIZE_HINT</a>, lxr-&gt;pLexer-&gt;tokSource);</div>
<div class="line">*  </div>
<div class="line">*      <span class="keywordflow">if</span> (tstream == NULL)</div>
<div class="line">*      {</div>
<div class="line">*       <a class="code" href="antlr3defs_8h.html#a27cc6fe6e2b9ed95c34ccbcf85149361">ANTLR3_FPRINTF</a>(stderr, <span class="stringliteral">&quot;Out of memory trying to allocate token stream\n&quot;</span>);</div>
<div class="line">*       exit(<a class="code" href="antlr3errors_8h.html#abbdcaff3e5d4da9691443e7ecdb671bf">ANTLR3_ERR_NOMEM</a>);</div>
<div class="line">*      }</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// Finally, now that we have our lexer constructed, we can create the parser</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      psr      = LangParserNew(tstream);  <span class="comment">// CParserNew is generated by ANTLR3</span></div>
<div class="line">*  </div>
<div class="line">*      <span class="keywordflow">if</span> (psr == NULL)</div>
<div class="line">*      {</div>
<div class="line">*       <a class="code" href="antlr3defs_8h.html#a27cc6fe6e2b9ed95c34ccbcf85149361">ANTLR3_FPRINTF</a>(stderr, <span class="stringliteral">&quot;Out of memory trying to allocate parser\n&quot;</span>);</div>
<div class="line">*       exit(<a class="code" href="antlr3errors_8h.html#abbdcaff3e5d4da9691443e7ecdb671bf">ANTLR3_ERR_NOMEM</a>);</div>
<div class="line">*      }</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// We are all ready to go. Though that looked complicated at first glance,</span></div>
<div class="line">*      <span class="comment">// I am sure, you will see that in fact most of the code above is dealing</span></div>
<div class="line">*      <span class="comment">// with errors and there isn;t really that much to do (isn;t this always the</span></div>
<div class="line">*      <span class="comment">// case in C? ;-).</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// So, we now invoke the parser. All elements of ANTLR3 generated C components</span></div>
<div class="line">*      <span class="comment">// as well as the ANTLR C runtime library itself are pseudo objects. This means</span></div>
<div class="line">*      <span class="comment">// that they are represented as pointers to structures, which contain any</span></div>
<div class="line">*      <span class="comment">// instance data they need, and a set of pointers to other interfaces or</span></div>
<div class="line">*      <span class="comment">// &#39;methods&#39;. Note that in general, these few pointers we have created here are</span></div>
<div class="line">*      <span class="comment">// the only things you will ever explicitly free() as everything else is created</span></div>
<div class="line">*      <span class="comment">// via factories, that allocate memory efficiently and free() everything they use</span></div>
<div class="line">*      <span class="comment">// automatically when you close the parser/lexer/etc.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      <span class="comment">// Note that this means only that the methods are always called via the object</span></div>
<div class="line">*      <span class="comment">// pointer and the first argument to any method, is a pointer to the structure itself.</span></div>
<div class="line">*      <span class="comment">// It also has the side advantage, if you are using an IDE such as VS2005 that can do it</span></div>
<div class="line">*      <span class="comment">// that when you type -&gt;, you will see a list of all the methods the object supports.</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*      langAST = psr-&gt;decl(psr);</div>
<div class="line">*  </div>
<div class="line">*      <span class="comment">// If the parser ran correctly, we will have a tree to parse. In general I recommend</span></div>
<div class="line">*      <span class="comment">// keeping your own flags as part of the error trapping, but here is how you can</span></div>
<div class="line">*      <span class="comment">// work out if there were errors if you are using the generic error messages</span></div>
<div class="line">*      <span class="comment">//</span></div>
<div class="line">*   <span class="keywordflow">if</span> (psr-&gt;pParser-&gt;rec-&gt;errorCount &gt; 0)</div>
<div class="line">*   {</div>
<div class="line">*       <a class="code" href="antlr3defs_8h.html#a27cc6fe6e2b9ed95c34ccbcf85149361">ANTLR3_FPRINTF</a>(stderr, <span class="stringliteral">&quot;The parser returned %d errors, tree walking aborted.\n&quot;</span>, psr-&gt;pParser-&gt;rec-&gt;errorCount);</div>
<div class="line">*  </div>
<div class="line">*   }</div>
<div class="line">*   <span class="keywordflow">else</span></div>
<div class="line">*   {</div>
<div class="line">*       nodes   = <a class="code" href="antlr3commontreenodestream_8c.html#a80515ce12fe3b7e18473029d07dceaa7">antlr3CommonTreeNodeStreamNewTree</a>(langAST.tree, <a class="code" href="antlr3defs_8h.html#a0f089eaab6993865d3d5daab26f8db98">ANTLR3_SIZE_HINT</a>); <span class="comment">// sIZE HINT WILL SOON BE DEPRECATED!!</span></div>
<div class="line">*  </div>
<div class="line">*       <span class="comment">// Tree parsers are given a common tree node stream (or your override)</span></div>
<div class="line">*       <span class="comment">//</span></div>
<div class="line">*       treePsr = LangDumpDeclNew(nodes);</div>
<div class="line">*  </div>
<div class="line">*       treePsr-&gt;decl(treePsr);</div>
<div class="line">*       nodes   -&gt;<a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_r_e_e___n_o_d_e___s_t_r_e_a_m__struct.html#aebf4caa6b0e7bbb320948665c72aa328">free</a>  (nodes);        nodes   = NULL;</div>
<div class="line">*       treePsr -&gt;<a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_r_e_e___n_o_d_e___s_t_r_e_a_m__struct.html#aebf4caa6b0e7bbb320948665c72aa328">free</a>  (treePsr);      treePsr = NULL;</div>
<div class="line">*   }</div>
<div class="line">*  </div>
<div class="line">*   <span class="comment">// We did not return anything from this parser rule, so we can finish. It only remains</span></div>
<div class="line">*   <span class="comment">// to close down our open objects, in the reverse order we created them</span></div>
<div class="line">*   <span class="comment">//</span></div>
<div class="line">*   psr     -&gt;free  (psr);      psr     = NULL;</div>
<div class="line">*   tstream -&gt;<a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_o_k_e_n___s_t_r_e_a_m__struct.html#a062b7949ea434d5a82cf1a07a3f8c7ff">free</a>  (tstream);  tstream = NULL;</div>
<div class="line">*   lxr     -&gt;<a class="code" href="struct_a_n_t_l_r3___c_o_m_m_o_n___t_o_k_e_n___s_t_r_e_a_m__struct.html#a062b7949ea434d5a82cf1a07a3f8c7ff">free</a>  (lxr);      lxr     = NULL;</div>
<div class="line">*   input   -&gt;<a class="code" href="struct_a_n_t_l_r3___i_n_p_u_t___s_t_r_e_a_m__struct.html#a1174c85bc9399c19072476c3187eec25">close</a> (input);    input   = NULL;</div>
<div class="line">*  </div>
<div class="line">*      <span class="keywordflow">return</span> 0;</div>
<div class="line">*  }</div>
<div class="line">*  </div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="index.html">ANTLR3 C Runtime API and Usage Guide.</a></li>
    <li class="footer">Generated on Tue Jan 7 2014 21:45:21 for ANTLR3C by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>