Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 5540

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Parser -- the class of all parsers</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_dead__Parser.html">next</a> | <a href="_nonspace__Analyzer.html">previous</a> | <a href="___Parser_sp_co_sp__Analyzer.html">forward</a> | <a href="___Analyzer.html">backward</a> | <a href="index.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<div><a href="index.html" title="a framework for building parsers">Parsing</a> > <a href="___Parser.html" title="the class of all parsers">Parser</a></div>
<hr/>
<div><h1>Parser -- the class of all parsers</h1>
<div class="single"><h2>Description</h2>
<div><p>A parser is a type of function that parses a sequence of tokens.  Tokens can be anything except <a href="../../Macaulay2Doc/html/_null.html" title="the unique member of the empty class">null</a>.  A parser <tt>p</tt> is called repeatedly, like this: <tt>p t</tt>, one token at a time.  The return value that indicates acceptance of the input token is a new parser, which replaces the old, and is ready to accept the next token; the original parser <tt>p</tt> should not change its internal state.  The return value that indicates rejection of the input token is <a href="../../Macaulay2Doc/html/_null.html" title="the unique member of the empty class">null</a>.  Rejection may be interpreted as a syntax error.</p>
<p>When the input stream is exhausted, we call <tt>p</tt> one more time like this: <tt>p null</tt>.  The return value is <a href="../../Macaulay2Doc/html/_null.html" title="the unique member of the empty class">null</a> if the parser is not in a terminal state.  Otherwise the return value is the parsed (and possibly evaluated) result.</p>
</div>
</div>
<div class="waystouse"><h2>Methods that use a parser :</h2>
<ul><li><span><a href="__st_sp__Parser.html" title="repetition of a parser">* Parser</a> -- repetition of a parser</span></li>
<li><span><a href="__pl_sp__Parser.html" title="repetition of a parser at least once">+ Parser</a> -- repetition of a parser at least once</span></li>
<li><span>Parser @ Parser, see <span><a href="_and__P.html" title="parser conjunction">andP</a> -- parser conjunction</span></span></li>
<li><span>Parser @ String, see <span><a href="_and__P.html" title="parser conjunction">andP</a> -- parser conjunction</span></span></li>
<li><span>String @ Parser, see <span><a href="_and__P.html" title="parser conjunction">andP</a> -- parser conjunction</span></span></li>
<li><span><a href="___Function_sp_pc_sp__Parser.html" title="transform the value returned by a parser">Function % Parser</a> -- transform the value returned by a parser</span></li>
<li><span>Parser | Parser, see <span><a href="_or__P.html" title="parsing alternatives">orP</a> -- parsing alternatives</span></span></li>
<li><span>Parser | String, see <span><a href="_or__P.html" title="parsing alternatives">orP</a> -- parsing alternatives</span></span></li>
<li><span>String | Parser, see <span><a href="_or__P.html" title="parsing alternatives">orP</a> -- parsing alternatives</span></span></li>
<li><span><a href="___Parser_sp_co_sp__Analyzer.html" title="combine a parser with a lexical analyzer to make a complete system">Parser : Analyzer</a> -- combine a parser with a lexical analyzer to make a complete system</span></li>
</ul>
<h2>Fixed objects of class Parser :</h2>
<ul><li><span><a href="_dead__Parser.html" title="a parser which accepts no tokens and is not in a terminal state">deadParser</a> -- a parser which accepts no tokens and is not in a terminal state</span></li>
<li><span><a href="_letter__Parser.html" title="a parser that accepts a single letter and returns it">letterParser</a> -- a parser that accepts a single letter and returns it</span></li>
<li><span><a href="___N__N__Parser.html" title="a parser that accepts (and returns) a natural number, one character at a time">NNParser</a> -- a parser that accepts (and returns) a natural number, one character at a time</span></li>
<li><span><a href="_null__Parser.html" title="a terminal parser that returns the value nil">nullParser</a> -- a terminal parser that returns the value nil</span></li>
<li><span><a href="_optional__Sign__Parser.html" title="a parser that accepts an optional plus sign or minus sign">optionalSignParser</a> -- a parser that accepts an optional plus sign or minus sign</span></li>
<li><span><a href="___Q__Q__Parser.html" title="a parser that accepts (and returns) a rational number, one character at a time">QQParser</a> -- a parser that accepts (and returns) a rational number, one character at a time</span></li>
<li><span><a href="___Z__Z__Parser.html" title="a parser that accepts (and returns) an integer, one character at a time">ZZParser</a> -- a parser that accepts (and returns) an integer, one character at a time</span></li>
</ul>
</div>
<div class="waystouse"><h2>For the programmer</h2>
<p>The object <a href="___Parser.html" title="the class of all parsers">Parser</a> is <span>a <a href="../../Macaulay2Doc/html/___Self__Initializing__Type.html">self initializing type</a></span>, with ancestor classes <a href="../../Macaulay2Doc/html/___Function__Closure.html" title="the class of all function closures">FunctionClosure</a> &lt; <a href="../../Macaulay2Doc/html/___Function.html" title="the class of all functions">Function</a> &lt; <a href="../../Macaulay2Doc/html/___Thing.html" title="the class of all things">Thing</a>.</p>
</div>
<div><h3>Menu</h3>
<h4>simple parsers</h4>
<ul><li><span><a href="_dead__Parser.html" title="a parser which accepts no tokens and is not in a terminal state">deadParser</a> -- a parser which accepts no tokens and is not in a terminal state</span></li>
<li><span><a href="_terminal__Parser.html" title="produce a parser in a terminal state">terminalParser</a> -- produce a parser in a terminal state</span></li>
<li><span><a href="_null__Parser.html" title="a terminal parser that returns the value nil">nullParser</a> -- a terminal parser that returns the value nil</span></li>
<li><span><a href="_future__Parser.html" title="forward reference to a parser not defined yet">futureParser</a> -- forward reference to a parser not defined yet</span></li>
<li><span><a href="_letter__Parser.html" title="a parser that accepts a single letter and returns it">letterParser</a> -- a parser that accepts a single letter and returns it</span></li>
<li><span><a href="_const__Parser.html" title="produce a parser that accepts a fixed string, one character at a time">constParser</a> -- produce a parser that accepts a fixed string, one character at a time</span></li>
<li><span><a href="_optional__Sign__Parser.html" title="a parser that accepts an optional plus sign or minus sign">optionalSignParser</a> -- a parser that accepts an optional plus sign or minus sign</span></li>
<li><span><a href="___N__N__Parser.html" title="a parser that accepts (and returns) a natural number, one character at a time">NNParser</a> -- a parser that accepts (and returns) a natural number, one character at a time</span></li>
<li><span><a href="___Z__Z__Parser.html" title="a parser that accepts (and returns) an integer, one character at a time">ZZParser</a> -- a parser that accepts (and returns) an integer, one character at a time</span></li>
<li><span><a href="___Q__Q__Parser.html" title="a parser that accepts (and returns) a rational number, one character at a time">QQParser</a> -- a parser that accepts (and returns) a rational number, one character at a time</span></li>
</ul>
<h4>making new parsers from old ones</h4>
<ul><li><span><a href="_opt__P.html" title="making a parser optional">optP</a> -- making a parser optional</span></li>
<li><span><a href="_or__P.html" title="parsing alternatives">orP</a> -- parsing alternatives</span></li>
<li><span><a href="_and__P.html" title="parser conjunction">andP</a> -- parser conjunction</span></li>
<li><span><a href="__st_sp__Parser.html" title="repetition of a parser">* Parser</a> -- repetition of a parser</span></li>
<li><span><a href="__pl_sp__Parser.html" title="repetition of a parser at least once">+ Parser</a> -- repetition of a parser at least once</span></li>
<li><span><a href="___Function_sp_pc_sp__Parser.html" title="transform the value returned by a parser">Function % Parser</a> -- transform the value returned by a parser</span></li>
</ul>
</div>
</div>
</body>
</html>