[all packages]
[package G4ip]
[class hierarchy]
[index]
public class G4ip.Parser
(source file: Parser.pizza)
java.lang.Object
|
+----G4ip.Parser
public class Parser
- A left-to-right, rightmost-derivation parser.
The following grammar is implemented:
- Formula ::= Id
| false
|
( Formula )
|
Formula Binop Formula
- Id is a string of lower case letters
- Binop is either
&, v, ->
or <->
- FormulaList ::= empty
|
[ FormulaList ,]* Formula
The parser uses a stack where two actions are performed:
- shift moves the next token to the top of the stack (getNextToken)
- reduce chooses a grammar rule, X -> A B C; pops A, B, C from the
top of the stack and pushes X onto the stack
- Author:
- Christian Urban

Parser(String)
-

getNextToken()
- tokens are: identifiers
( ) , & v -> <-> false
and EOI
parseFormula()
- parses a single formula
parseFormulae()
- parses a list of formulae separated by commas
reduce()
- Implements the grammar rules.

Parser
public Parser(String init_in);

getNextToken
public Token getNextToken()
throws Exception;
- tokens are: identifiers
( ) , & v -> <-> false
and EOI
(end of input)
- Overrides:
- getNextToken in class Parser
reduce
public void reduce();
- Implements the grammar rules.
- Overrides:
- reduce in class Parser
parseFormula
public Form parseFormula()
throws Exception;
- parses a single formula
- Overrides:
- parseFormula in class Parser
parseFormulae
public Context parseFormulae()
throws