xtc.parser
Class TreeTyper

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

public class TreeTyper
extends Visitor

Visitor to determine a grammar's tree structure. This visitor assumes that the entire grammar is contained in a single module and has been annotated with appropriate value elements.

Version:
$Revision: 1.26 $

Field Summary
protected  Analyzer analyzer
          The analyzer utility.
protected  AST ast
          The common type operations.
protected  boolean flatten
          The flag for flattening lists.
protected  Runtime runtime
          The runtime.
protected  Sequence sequence
          The current sequence.
protected  boolean strict
          The flag for strict unification.
 
Constructor Summary
TreeTyper(Runtime runtime, Analyzer analyzer, AST ast)
          Create a new tree typer.
 
Method Summary
protected  void process(String name, boolean isAction, List<Binding> children)
          Determine the type of the specified generic node constructor.
 void visit(Element e)
          Visit the specified element.
 void visit(GenericActionValue v)
          Visit the specified generic action value.
 void visit(GenericNodeValue v)
          Visit the specified generic node value.
 void visit(Module m)
          Visit the specified module.
 void visit(OrderedChoice c)
          Visit the specified ordered choice.
 void visit(Production p)
          Visit the specified production.
 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.


strict

protected boolean strict
The flag for strict unification.


flatten

protected boolean flatten
The flag for flattening lists.


sequence

protected Sequence sequence
The current sequence.

Constructor Detail

TreeTyper

public TreeTyper(Runtime runtime,
                 Analyzer analyzer,
                 AST ast)
Create a new tree typer.

Parameters:
runtime - The runtime.
ast - The type operations.
analyzer - The analyzer utility.
Method Detail

visit

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


visit

public void visit(Production p)
Visit the specified 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(UnaryOperator op)
Visit the specified unary operator.


visit

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


visit

public void visit(GenericNodeValue v)
Visit the specified generic node value.


visit

public void visit(GenericActionValue v)
Visit the specified generic action value.


process

protected void process(String name,
                       boolean isAction,
                       List<Binding> children)
Determine the type of the specified generic node constructor.

Parameters:
name - The constructor's name.
isAction - The flag for whether the constructor appears in an action.
children - The list of bindings for the children.


(C) Copyright 2004-2007 Robert Grimm, New York University, IBM, and Princeton