|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.nlp.Parsing.Parser
public class Parser
Generic Language Parser.
$Id: Parser.java,v 1.25 2008/01/03 03:21:57 mokhov Exp $
| Field Summary | |
|---|---|
protected boolean |
bErrorsPresent
Fact, indicating that there are syntax errors. |
protected java.util.Stack |
oBracketStack
Stack for checking mismatched brackets. |
protected java.util.Vector |
oSyntaxErrors
A list of Syntax Errors so far. |
| Constructor Summary | |
|---|---|
Parser(java.lang.String[] argv)
Constructor with command-line arguments. |
|
| Method Summary | |
|---|---|
boolean |
areErrorsPresent()
Allows to query the fact that there were lexical or syntax errors or not. |
GrammarCompiler |
getGrammarCompiler()
Allows querying for the grammar compiler used. |
LexicalAnalyzer |
getLexer()
Allows querying for the instance of the lexer. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
java.util.Stack |
getStack()
Allows querying for the current stack. |
static SymbolTable |
getSymbolTable()
Allows querying for the current symbol table. |
java.util.Vector |
getSyntaxErrors()
Allows querying for the recorded syntax errors that were found. |
TransitionTable |
getTransitionTable()
Allows querying for the current transition table. |
boolean |
parse()
Implements State Transition Algorithm for top-down table-driven predictive parser. |
Token |
popBracket()
Pops a bracket-type token from the stack. |
void |
pushBracket(Token poToken)
Pushes bracket-type token onto the bracket stack. |
void |
setErrorsPresent(boolean pbErrorsPresent)
Allows externally setting the fact that there were errors. |
void |
setGrammarCompiler(GrammarCompiler poGrammarCompiler)
Allows setting a new grammar compiler to use. |
void |
setLexer(LexicalAnalyzer poLexer)
Allows setting a new lexer for scanning. |
static void |
setSymbolTable(SymbolTable poSymTab)
Allows setting a new symbol table. |
void |
setTransitionTable(TransitionTable poTT)
Allows setting a new transition table. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Vector oSyntaxErrors
protected boolean bErrorsPresent
protected java.util.Stack oBracketStack
| Constructor Detail |
|---|
public Parser(java.lang.String[] argv)
throws CompilerError
argv - the command-line arguments
CompilerError - if there are problems initializing a lexer or a transition table| Method Detail |
|---|
public void pushBracket(Token poToken)
poToken - the bracket-type tokenpublic Token popBracket()
public boolean parse()
throws SyntaxError,
LexicalError
true if the parse was successful
SyntaxError - if a parsed statement for some reason does not conform the grammar
LexicalError - if an invalid token read off the source character streampublic static SymbolTable getSymbolTable()
public static void setSymbolTable(SymbolTable poSymTab)
poSymTab - the global symbol table to setpublic boolean areErrorsPresent()
true if there were errors in parsingpublic void setErrorsPresent(boolean pbErrorsPresent)
pbErrorsPresent - the new value of the flagpublic LexicalAnalyzer getLexer()
public void setLexer(LexicalAnalyzer poLexer)
poLexer - the new lexer to be usedpublic GrammarCompiler getGrammarCompiler()
public void setGrammarCompiler(GrammarCompiler poGrammarCompiler)
poGrammarCompiler - the new grammar compilerpublic java.util.Stack getStack()
public TransitionTable getTransitionTable()
public void setTransitionTable(TransitionTable poTT)
poTT - the new transition table data structure to setpublic java.util.Vector getSyntaxErrors()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||