|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxtc.tree.Visitor
xtc.parser.GrammarVisitor
xtc.parser.Simplifier
public class Simplifier
Visitor to simplify a grammar. This visitor folds nested choices
and sequences into the embedding choice or sequence, eliminates
choices and sequences with only one alternative or element (with
the exception of the top-level choice of a production), and reduces
repetitions and options to their simplest form. It also reduces
trivial character classes and string literals to character
literals. Note that the resulting grammar may violate the
requirements of code generation.
| Field Summary |
|---|
| Fields inherited from class xtc.parser.GrammarVisitor |
|---|
analyzer, isBound, isLastElement, isPredicate, isRepeatedOnce, isTopLevel, isVoided, needsSequence, runtime, transformInPlace |
| Constructor Summary | |
|---|---|
Simplifier(Runtime runtime,
Analyzer analyzer)
Create a new simplifier. |
|
| Method Summary | |
|---|---|
Element |
visit(Binding b)
Visit the specified binding. |
Element |
visit(CharClass c)
Visit the specified character class. |
Element |
visit(Option o)
Visit the specified option. |
Element |
visit(OrderedChoice c)
Visit the specified ordered choice. |
Element |
visit(Repetition r)
Visit the specified repetition. |
Element |
visit(Sequence s)
Visit the specified sequence. |
Element |
visit(StringMatch m)
Visit the specified string match. |
Element |
visit(VoidedElement v)
Visit the specified voided element. |
| Methods inherited from class xtc.parser.GrammarVisitor |
|---|
visit, visit, visit, visit, visit, visit, visit, visit, visit |
| Methods inherited from class xtc.tree.Visitor |
|---|
dispatch, equals, hashCode, iterate, map, mapInPlace, unableToVisit, visit |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Simplifier(Runtime runtime,
Analyzer analyzer)
runtime - The runtime.analyzer - The analyzer utility.| Method Detail |
|---|
public Element visit(OrderedChoice c)
visit in class GrammarVisitorpublic Element visit(Repetition r)
visit in class GrammarVisitorpublic Element visit(Option o)
visit in class GrammarVisitorpublic Element visit(Sequence s)
visit in class GrammarVisitorpublic Element visit(VoidedElement v)
visit in class GrammarVisitorpublic Element visit(Binding b)
visit in class GrammarVisitorpublic Element visit(StringMatch m)
visit in class GrammarVisitorpublic Element visit(CharClass c)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||