<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">+ −
<!--NewPage-->+ −
<html>+ −
<head>+ −
<!-- generated by pizzadoc on Thu Oct 30 13:46:18 GMT+00:00 1997 -->+ −
<title>+ −
public class G4ip.Parser+ −
</title>+ −
</head>+ −
<body bgcolor=FFFFFF>+ −
<a name="_top_"></a>+ −
<code><font size=-1>+ −
[<a href="index.html">all packages</a>] + −
[<a href="G4ip.html">package G4ip</a>] + −
[<a href="tree-pd.html">class hierarchy</a>] + −
[<a href="names-pd.html">index</a>] + −
</font></code>+ −
<hr>+ −
<h1>public class G4ip.Parser</h1>+ −
(source file: Parser.pizza)<br>+ −
<pre>+ −
<a href="http://java.sun.com:80/products/jdk/1.1/docs/api/java.lang.Object.html">java.lang.Object</a>+ −
|+ −
+----G4ip.Parser+ −
</pre>+ −
<hr>+ −
<pre>+ −
public class <a href="G4ip.Parser.html">Parser</a>+ −
</pre>+ −
<dl>+ −
<dd> A left-to-right, rightmost-derivation parser.<p> + −
The following grammar is implemented:<p>+ −
<dl>+ −
<dd><u>Formula</u> ::= <u>Id</u> </dd>+ −
<dd><code>| false</code> </dd>+ −
<dd><code>|</code> ( <u>Formula</u> ) </dd> + −
<dd><code>|</code> <u>Formula</u> <u>Binop</u> <u>Formula</u></dd> + −
</dl><p>+ −
<dl>+ −
<dd><u>Id</u> is a string of lower case letters</dd>+ −
</dl><p>+ −
<dl>+ −
<dd><u>Binop</u> is either <code>&, v, -></code> or <code><-></code></dd>+ −
</dl><p>+ −
<dl>+ −
<dd><u>FormulaList</u> ::= <em>empty</em></dd>+ −
<dd><code>|</code> [ <u>FormulaList</u> ,]* <u>Formula</u></dd>+ −
<dl><p>+ −
The parser uses a stack where two actions are performed:+ −
<dl>+ −
<dd><b>shift</b> moves the next token to the top of the stack (getNextToken)</dd>+ −
<dd><b>reduce</b> chooses a grammar rule, X -> A B C; pops A, B, C from the + −
top of the stack and pushes X onto the stack + −
</dl><p></dd>+ −
<dd><dl><dt></dt>+ −
<dt> <b>Author:</b></dt>+ −
<dd> Christian Urban</dd>+ −
</dl></dd>+ −
</dl>+ −
<hr>+ −
<p><h2><img src="p-images/constructor-index.gif" alt="Constuctor Index"></h2>+ −
<dl>+ −
<dt><img src="p-images/yellow-ball-small.gif" alt="O "> <b><a href="G4ip.Parser.html#Parser(String)">Parser</a></b>(String)+ −
<dd>+ −
</dl>+ −
<p><h2><img src="p-images/method-index.gif" alt="Methods"></h2>+ −
<dl>+ −
<dt><img src="p-images/red-ball-small.gif" alt="O "> <b><a href="G4ip.Parser.html#getNextToken()">getNextToken</a></b>()+ −
<dd>tokens are: identifiers<code>( ) , & v -> <-> false</code> + −
and <code>EOI</code> + −
<dt><img src="p-images/red-ball-small.gif" alt="O "> <b><a href="G4ip.Parser.html#parseFormula()">parseFormula</a></b>()+ −
<dd>parses a single formula+ −
<dt><img src="p-images/red-ball-small.gif" alt="O "> <b><a href="G4ip.Parser.html#parseFormulae()">parseFormulae</a></b>()+ −
<dd>parses a list of formulae separated by commas+ −
<dt><img src="p-images/red-ball-small.gif" alt="O "> <b><a href="G4ip.Parser.html#reduce()">reduce</a></b>()+ −
<dd>Implements the grammar rules.+ −
</dl>+ −
<p><h2><img src="p-images/constructors.gif" alt="Constructors"></h2>+ −
<img src="p-images/yellow-ball.gif" alt="O "> <a name="<init>"></a><a name="Parser(String)"></a><b>Parser</b><br>+ −
<pre>+ −
public Parser(<a href="http://java.sun.com:80/products/jdk/1.1/docs/api/java.lang.String.html">String</a> init_in);+ −
</pre>+ −
<p>+ −
<p><h2><img src="p-images/methods.gif" alt="Methods"></h2>+ −
<img src="p-images/red-ball.gif" alt="O "> <a name="getNextToken"></a><a name="getNextToken()"></a><b>getNextToken</b><br>+ −
<pre>+ −
public <a href="G4ip.Token.html">Token</a> getNextToken()+ −
throws <a href="http://java.sun.com:80/products/jdk/1.1/docs/api/java.lang.Exception.html">Exception</a>;+ −
</pre>+ −
<dl>+ −
<dd> tokens are: identifiers<code>( ) , & v -> <-> false</code> + −
and <code>EOI</code> <em>(end of input)</em> <p></dd>+ −
<dd><dl><dt></dt>+ −
<dt> <b>Overrides:</b></dt>+ −
<dd><dl>+ −
<dt><b><a href="G4ip.Parser.html#getNextToken()">getNextToken</a></b> in class <a href="G4ip.Parser.html">Parser</a></dt>+ −
</dl></dd>+ −
</dl></dd>+ −
</dl>+ −
<p>+ −
<img src="p-images/red-ball.gif" alt="O "> <a name="reduce"></a><a name="reduce()"></a><b>reduce</b><br>+ −
<pre>+ −
public void reduce();+ −
</pre>+ −
<dl>+ −
<dd> Implements the grammar rules.<p></dd>+ −
<dd><dl><dt></dt>+ −
<dt> <b>Overrides:</b></dt>+ −
<dd><dl>+ −
<dt><b><a href="G4ip.Parser.html#reduce()">reduce</a></b> in class <a href="G4ip.Parser.html">Parser</a></dt>+ −
</dl></dd>+ −
</dl></dd>+ −
</dl>+ −
<p>+ −
<img src="p-images/red-ball.gif" alt="O "> <a name="parseFormula"></a><a name="parseFormula()"></a><b>parseFormula</b><br>+ −
<pre>+ −
public <a href="G4ip.Form.html">Form</a> parseFormula()+ −
throws <a href="http://java.sun.com:80/products/jdk/1.1/docs/api/java.lang.Exception.html">Exception</a>;+ −
</pre>+ −
<dl>+ −
<dd> parses a single formula<p></dd>+ −
<dd><dl><dt></dt>+ −
<dt> <b>Overrides:</b></dt>+ −
<dd><dl>+ −
<dt><b><a href="G4ip.Parser.html#parseFormula()">parseFormula</a></b> in class <a href="G4ip.Parser.html">Parser</a></dt>+ −
</dl></dd>+ −
</dl></dd>+ −
</dl>+ −
<p>+ −
<img src="p-images/red-ball.gif" alt="O "> <a name="parseFormulae"></a><a name="parseFormulae()"></a><b>parseFormulae</b><br>+ −
<pre>+ −
public <a href="G4ip.Context.html">Context</a> parseFormulae()+ −
throws <a href="http://java.sun.com:80/products/+ −