|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsimple.parser.SimpleParser
public class SimpleParser
This class defines a object that parses a stream of
Token generated by Lexer using
the following LL(1) grammar:
Note that the token manipulation itself is encapsulated. The structure of the parser follows a standard recursive descent algorithm, consulting the following parsing table:
| + or - | * or / | [0-9] | ( | ) | $ | |
|---|---|---|---|---|---|---|
| S | (1) | (1) | ||||
| E | (2) | (2) | ||||
| E' | (3) or (4) | (5) | (5) | |||
| T | (6) | (6) | ||||
| T' | (9) | (7) or (8) | (9) | (9) | ||
| F | (10) | (11) |
Lexer| Constructor Summary | |
|---|---|
SimpleParser(java.lang.String src)
Creates a parser object, passing it a source expression string. |
|
| Method Summary | |
|---|---|
Stmt |
parse()
Parses the source string, returning a parse tree rooted with a Stmt node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleParser(java.lang.String src)
throws ParseException
src - the source expression string
ParseException - if token lexer analysis throws
an exception (unknown character)| Method Detail |
|---|
public Stmt parse()
throws ParseException
Stmt node.
ParseExceptionParseNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||