|
Absimpa v196 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectabsimpa.Grammar<N,C>
N - is the type of the objects created by the parser generated from
this grammarC - is the type of token codes provided by the lexer that will be
used by this parserpublic abstract class Grammar<N,C extends java.lang.Enum<C>>
The Grammar describes a language made of sequences of C
objects provided by a Lexer. To create a Grammar,
use a GrammarBuilder. Then call compile() to obtain a
Parser for the language described by this Grammar.
| Method Summary | |
|---|---|
Parser<N,C> |
compile()
compiles the grammar into a parser to recognize the grammar. |
java.lang.String |
getName()
|
Grammar<N,C> |
opt()
wraps this into a Repeat with min=0 and {code
max=1}. |
Grammar<N,C> |
opt(NodeFactory<N> nf)
wraps this into a Repeat with min=0 and {code
max=1}. |
Grammar<N,C> |
rep(NodeFactory<N> nf,
int min,
int max)
wraps this into a Repeat. |
java.lang.String |
ruleString()
|
Grammar<N,C> |
setName(java.lang.String name)
used by toString() only, not needed for the function of the
grammar. |
Grammar<N,C> |
setNodeFactory(NodeFactory<N> nf)
|
Grammar<N,C> |
star()
wraps this into a Repeat with min=0 and {code
max} really huge. |
Grammar<N,C> |
star(NodeFactory<N> nf)
wraps this into a Repeat with min=0 and {code
max} really huge. |
java.lang.String |
toBNF()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public final Parser<N,C> compile()
LeftRecursiveException - if the grammar is left
recursive.
LookaheadConflictException - if either a Choice or a
Sequence encountered during compilation has a lookahead
conflict.
public Grammar<N,C> rep(NodeFactory<N> nf,
int min,
int max)
wraps this into a Repeat.
public Grammar<N,C> star(NodeFactory<N> nf)
wraps this into a Repeat with min=0 and {code
max} really huge.
public Grammar<N,C> star()
wraps this into a Repeat with min=0 and {code
max} really huge.
public Grammar<N,C> opt(NodeFactory<N> nf)
wraps this into a Repeat with min=0 and {code
max=1}.
public Grammar<N,C> opt()
wraps this into a Repeat with min=0 and {code
max=1}.
public Grammar<N,C> setNodeFactory(NodeFactory<N> nf)
public final java.lang.String ruleString()
public Grammar<N,C> setName(java.lang.String name)
toString() only, not needed for the function of the
grammar.
public java.lang.String getName()
public final java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.String toBNF()
|
Absimpa v196 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||