Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > dd7a95aabe1c049ac9f84beede8143d3 > files > 134

synopsis-doc-0.12-4.fc14.i686.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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/html; charset=UTF-8" /><title>The Symbol Table Module</title><link rel="stylesheet" href="synopsis.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Synopsis Developer's Guide" /><link rel="up" href="cxx.html" title="Chapter 3. The C++ API" /><link rel="prev" href="ptree.html" title="The Parse Tree Module" /><link rel="next" href="type-analysis.html" title="The Type Analysis Module" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The Symbol Table Module</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ptree.html">Prev</a> </td><th width="60%" align="center">Chapter 3. The C++ API</th><td width="20%" align="right"> <a accesskey="n" href="type-analysis.html">Next</a></td></tr></table></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="symbol-table"></a>The Symbol Table Module</h2></div></div></div><p>
        A symbol table is a representation of the source code that provides a means to associate names
        with symbols, i.e. objects of a specific type. Such a symbol table is a graph composed of interconnected
        <span class="emphasis"><em>scopes</em></span>, and the type of the scopes as well as the topology of the graph determine
        how the symbol lookup is performed.
      </p><p>
        Symbols are declared by the parser as soon as they are encountered, since the parser itself may need
        them later to disambiguate certain syntactic constructs.
      </p><div class="mediaobject"><img src="images/symbol-table.png" /></div><p></p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="symbol-display"></a>SymbolTable::Display</h3></div></div></div><p>
          As a way to inspect the constructed symbol table, the <code class="code">SymbolTable</code> module provides a simple
          API to print the content of a <code class="code">Scope</code>.
        </p><p>
          </p><pre class="programlisting">
            SymbolTable::display(scope, std::cout);
          </pre><p>
          will print the scope referred to by <code class="varname">scope</code> to <code class="varname">std::cout</code>.
        </p><p>
          Again, this API turned out to be rather useful, and so there is a stand-alone applet that just
          generates a symbol table and then prints it out using the above function.
          </p><pre class="programlisting">
            display-symbols [-d] &lt;input&gt;
          </pre><p>
          The available options are:
        </p><div class="variablelist"><dl><dt><span class="term">-d</span></dt><dd><p>Print debug information (in particular traces) during the parsing.</p></dd></dl></div></div></div><div class="navfooter"><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ptree.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="cxx.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="type-analysis.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The Parse Tree Module </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The Type Analysis Module</td></tr></table></div></body></html>