|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.uzh.ifi.attempto.chartparser.ChartParser
public class ChartParser
This is a chart parser (concretely an Earley parser) fully implemented in Java. However, there is a Prolog format ("Attempto Chartparser Grammar Notation" or "ACGN") that can be transformed into Java (at compile time).
Grammar
Constructor Summary | |
---|---|
ChartParser(Grammar grammar)
Creates a new chart parser for the given grammar. |
Method Summary | |
---|---|
void |
addToken(Terminal... token)
Adds the token to the token sequence and makes one more parsing step to process it. |
void |
addTokens(java.util.List<Terminal> tokens)
Adds the tokens to the token sequence and processes them. |
void |
debug(boolean debug)
This method can be used to switch on/off debug mode (default is off). |
boolean[] |
getAccessiblePositions(java.lang.String nextToken)
Returns a boolean array that describes which of the tokens of the current token sequence are accessible (true) and which are not (false) for the given next token. |
java.util.List<java.lang.Object> |
getTokens()
Returns the current token sequence. |
java.util.List<Terminal> |
nextTokens()
Returns all tokens that are allowed to follow the current token sequence according to the grammar. |
void |
removeAllTokens()
Removes all tokens in the current token sequence and resets the chart. |
void |
removeToken()
Removes the last token and reverts the last parsing step. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChartParser(Grammar grammar)
grammar
- The grammar to be used by the chart parser.Method Detail |
---|
public void debug(boolean debug)
debug
- true to switch on debug mode or false to switch it off.public void addToken(Terminal... token)
token
- The token to be added to the token sequence.public void addTokens(java.util.List<Terminal> tokens)
tokens
- The tokens to be added to the token sequence.public void removeToken()
public void removeAllTokens()
public java.util.List<java.lang.Object> getTokens()
public java.util.List<Terminal> nextTokens()
public boolean[] getAccessiblePositions(java.lang.String nextToken)
nextToken
- The next token for which the tokens should be checked for accessibility.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |