|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fri.patterns.interpreter.parsergenerator.parsertables.AbstractParserTables | +--fri.patterns.interpreter.parsergenerator.parsertables.SLRParserTables
A table generator, building SLR bottom-up parser tables from a syntax.
An artifical START-node gets inserted. Lists of nonterminals and terminals are created. Syntax nodes are created, from which the parser GOTO and PARSE-ACTION tables get built.
This class contains dump methods for syntax nodes and FIRST/FOLLOW sets.
Field Summary | |
protected fri.patterns.interpreter.parsergenerator.parsertables.FirstSets |
firstSets
|
protected fri.patterns.interpreter.parsergenerator.parsertables.FollowSets |
followSets
|
protected java.util.List |
syntaxNodes
|
Fields inherited from class fri.patterns.interpreter.parsergenerator.parsertables.AbstractParserTables |
CELLWIDTH, gotoTable, nonterminals, parseTable, symbols, syntax, terminals, terminalsWithoutEpsilon |
Fields inherited from interface fri.patterns.interpreter.parsergenerator.ParserTables |
ACCEPT, ERROR, SHIFT |
Constructor Summary | |
SLRParserTables(Syntax syntax)
Appends START symbol and retrieves all symbols. |
Method Summary | |
void |
dump(java.io.PrintStream out)
Implements ParserTables: output of rules, FIRST/FOLLOW sets, syntax nodes, GOTO-table, PARSE-ACTON-table. |
void |
dumpFirstSet(java.io.PrintStream out)
|
void |
dumpFollowSet(java.io.PrintStream out)
|
void |
dumpSet(java.lang.String header,
java.util.Map set,
java.io.PrintStream out)
|
void |
dumpSyntaxNode(int i,
fri.patterns.interpreter.parsergenerator.parsertables.SLRSyntaxNode node,
java.io.PrintStream out)
|
void |
dumpSyntaxNodes(java.io.PrintStream out)
|
void |
freeSyntaxNodes()
Enable garbage collection of builder variables. |
protected java.util.List |
generateGoto(java.util.List syntaxNodes)
Creates GOTO table of follow states. |
protected java.util.List |
generateParseAction(java.util.List syntaxNodes)
Erzeugen der Parse-Action-Tabelle fuer shift/reduce Aktionen. |
protected java.util.List |
getAllSymbols()
Returns all symbols (terminals and nonterminals). |
protected void |
init()
Builds SLR bottom-up parser tables. |
protected void |
insertTableLine(int i,
java.util.Map line,
java.util.List table,
java.util.Map hash)
Compression of tables: Look for an identical table line. |
static void |
main(java.lang.String[] args)
Test main dumping arithmetic expression tables. |
void |
report(java.io.PrintStream out)
Overridden to report better. |
Methods inherited from class fri.patterns.interpreter.parsergenerator.parsertables.AbstractParserTables |
construct, dumpGoto, dumpParseAction, dumpRule, dumpSyntax, dumpTable, dumpTables, getExpected, getGotoState, getParseAction, getSyntax, getTerminals, toSourceFile |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected transient java.util.List syntaxNodes
protected transient fri.patterns.interpreter.parsergenerator.parsertables.FirstSets firstSets
protected transient fri.patterns.interpreter.parsergenerator.parsertables.FollowSets followSets
Constructor Detail |
public SLRParserTables(Syntax syntax) throws ParserBuildException
Method Detail |
protected void init() throws ParserBuildException
ParserBuildException
protected java.util.List getAllSymbols() throws ParserBuildException
ParserBuildException
protected java.util.List generateGoto(java.util.List syntaxNodes)
protected java.util.List generateParseAction(java.util.List syntaxNodes)
protected void insertTableLine(int i, java.util.Map line, java.util.List table, java.util.Map hash)
public void freeSyntaxNodes()
public void report(java.io.PrintStream out)
report
in class AbstractParserTables
public void dump(java.io.PrintStream out)
dump
in interface ParserTables
dump
in class AbstractParserTables
public void dumpSyntaxNodes(java.io.PrintStream out)
public void dumpSyntaxNode(int i, fri.patterns.interpreter.parsergenerator.parsertables.SLRSyntaxNode node, java.io.PrintStream out)
public void dumpFirstSet(java.io.PrintStream out)
public void dumpFollowSet(java.io.PrintStream out)
public void dumpSet(java.lang.String header, java.util.Map set, java.io.PrintStream out)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |