|
Building Parsers with Java | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--sjm.examples.midimath.Midimath
This class creates and uses a parser that recognizes arithmetic expressions that use addition and multiplication. The rules of the Midimath language are:
expression = term ('+' term)*;
term = Num ('*' Num)*;
This class exists to show operator precedence.
| Constructor Summary | |
Midimath()
|
|
| Method Summary | |
Parser |
expression()
Returns a parser that will recognize a Midimath expression. |
static void |
main(java.lang.String[] args)
Demonstrate a parser for Midimath. |
protected Parser |
term()
Returns a parser that will recognize arithmetic expressions containing just multiplication. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Midimath()
| Method Detail |
public Parser expression()
public static void main(java.lang.String[] args)
protected Parser term()
|
by Steve Metsker | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||