xtc.parser
Class TreeExtractor

java.lang.Object
  extended by xtc.tree.Visitor
      extended by xtc.parser.TreeExtractor

public class TreeExtractor
extends Visitor

Visitor to pear down a grammar to the structure of its abstract syntax tree. This visitor assumes that the entire grammar is contained in a single module. It also assumes that directly left-recursive generic productions have not been transformed by DirectLeftRecurser. Note that, after this visitor has processed the grammar, the grammar violates the code generator's requirements. Also note that this visitor internally uses Simplifier and DeadProductionEliminator.

Version:
$Revision: 1.11 $
Author:
Robert Grimm

Field Summary
protected  Analyzer analyzer
          The analyzer utility.
protected  AST ast
          The common type operations.
protected  boolean isGeneric
          The flag for whether the current production is generic.
protected  boolean isList
          The flag for whether the current production is list-valued.
protected  boolean isTextOnly
          The flag for whether the current production is text-only.
protected  boolean isToken
          The flag for whether the current production is token-level.
protected  boolean keepLexical
          The flag for removing all elements from lexical productions.
protected  Runtime runtime
          The runtime.
protected  boolean setsValue
          The flag for whether the current production defines the semantic value in an explicit action.
 
Constructor Summary
TreeExtractor(Runtime runtime, Analyzer analyzer, AST ast, boolean keepLexical)
          Create a new tree extractor.
 
Method Summary
 void visit(CharCase c)
          Visit the specified character case.
 void visit(CharSwitch s)
          Visit the specified character switch.
 void visit(Element e)
          Visit the specified element.
 void visit(FullProduction p)
          Visit the specified full production.
 void visit(Module m)
          Visit the specified module.
 void visit(OrderedChoice c)
          Visit the specified ordered choice.
 void visit(Sequence s)
          Visit the specified sequence.
 void visit(UnaryOperator op)
          Visit the specified unary operator.
 
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
 

Field Detail

runtime

protected final Runtime runtime
The runtime.


analyzer

protected final Analyzer analyzer
The analyzer utility.


ast

protected final AST ast
The common type operations.


keepLexical

protected final boolean keepLexical
The flag for removing all elements from lexical productions.


isGeneric

protected boolean isGeneric
The flag for whether the current production is generic.


isList

protected boolean isList
The flag for whether the current production is list-valued.


isTextOnly

protected boolean isTextOnly
The flag for whether the current production is text-only.


isToken

protected boolean isToken
The flag for whether the current production is token-level.


setsValue

protected boolean setsValue
The flag for whether the current production defines the semantic value in an explicit action.

Constructor Detail

TreeExtractor

public TreeExtractor(Runtime runtime,
                     Analyzer analyzer,
                     AST ast,
                     boolean keepLexical)
Create a new tree extractor.

Parameters:
runtime - The runtime.
analyzer - The analyzer utility.
ast - The type operations.
keepLexical - The flag for keeping elements of text-only or token-level productions.
Method Detail

visit

public void visit(Module m)
Visit the specified module.


visit

public void visit(FullProduction p)
Visit the specified full production.


visit

public void visit(OrderedChoice c)
Visit the specified ordered choice.


visit

public void visit(Sequence s)
Visit the specified sequence.


visit

public void visit(CharCase c)
Visit the specified character case.


visit

public void visit(CharSwitch s)
Visit the specified character switch.


visit

public void visit(UnaryOperator op)
Visit the specified unary operator.


visit

public void visit(Element e)
Visit the specified element.



Copyright © 2012. All Rights Reserved.