| java.lang.Object fri.patterns.interpreter.parsergenerator.parsertables.AbstractParserTables fri.patterns.interpreter.parsergenerator.parsertables.SLRParserTables
All known Subclasses: fri.patterns.interpreter.parsergenerator.parsertables.LRParserTables,
SLRParserTables | public class SLRParserTables extends AbstractParserTables (Code) | | 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.
author: (c) 2000, Fritz Ritzberger |
Constructor Summary | |
public | SLRParserTables(Syntax syntax) Appends START symbol and retrieves all symbols. |
Method Summary | |
public void | dump(PrintStream out) Implements ParserTables: output of rules, FIRST/FOLLOW sets, syntax nodes, GOTO-table, PARSE-ACTON-table. | public void | dumpFirstSet(PrintStream out) | public void | dumpFollowSet(PrintStream out) | public void | dumpSet(String header, Map set, PrintStream out) | public void | dumpSyntaxNode(int i, SLRSyntaxNode node, PrintStream out) | public void | dumpSyntaxNodes(PrintStream out) | public void | freeSyntaxNodes() Enable garbage collection of builder variables. | protected List | generateGoto(List syntaxNodes) Creates GOTO table of follow states. | protected List | generateParseAction(List syntaxNodes) Erzeugen der Parse-Action-Tabelle fuer shift/reduce Aktionen. | protected List | getAllSymbols() Returns all symbols (terminals and nonterminals). | protected void | init() Builds SLR bottom-up parser tables. | protected void | insertTableLine(int i, Map line, List table, Map hash) Compression of tables: Look for an identical table line. | public static void | main(String[] args) Test main dumping arithmetic expression tables. | public void | report(PrintStream out) Overridden to report better. |
syntaxNodes | protected transient List syntaxNodes(Code) | | |
SLRParserTables | public SLRParserTables(Syntax syntax) throws ParserBuildException(Code) | | Appends START symbol and retrieves all symbols. Calls init then.
All parser table types run through this constructor.
|
dump | public void dump(PrintStream out)(Code) | | Implements ParserTables: output of rules, FIRST/FOLLOW sets, syntax nodes, GOTO-table, PARSE-ACTON-table.
|
freeSyntaxNodes | public void freeSyntaxNodes()(Code) | | Enable garbage collection of builder variables. CAUTION: dump methods work reduced after this call.
|
generateGoto | protected List generateGoto(List syntaxNodes)(Code) | | Creates GOTO table of follow states.
|
generateParseAction | protected List generateParseAction(List syntaxNodes)(Code) | | Erzeugen der Parse-Action-Tabelle fuer shift/reduce Aktionen.
|
getAllSymbols | protected List getAllSymbols() throws ParserBuildException(Code) | | Returns all symbols (terminals and nonterminals). Builds lists. Called only once on construction.
|
insertTableLine | protected void insertTableLine(int i, Map line, List table, Map hash)(Code) | | Compression of tables: Look for an identical table line.
identical line Zeile, or passed line when not found. |
main | public static void main(String[] args)(Code) | | Test main dumping arithmetic expression tables.
|
|
|