gnu.expr
Class ExpWalker

java.lang.Object
  extended by gnu.expr.ExpWalker
Direct Known Subclasses:
ChainLambdas, FindCapturedVars, FindTailCalls, InlineCalls, PushApply, ResolveNames

public class ExpWalker
extends java.lang.Object

Class for doing a tree-walk over an Expression tree.


Constructor Summary
ExpWalker()
           
 
Method Summary
 void error(char kind, java.lang.String message)
           
 int getColumn()
           
 Compilation getCompilation()
          Get the Compilation associated with this walker.
 LambdaExp getCurrentLambda()
           
 java.lang.String getFile()
           
 int getLine()
           
 Expression noteError(java.lang.String message)
           
 void setColumn(int column)
           
 void setContext(Compilation comp)
           
 void setFile(java.lang.String filename)
           
 void setLine(int line)
           
 void setLine(java.lang.String filename, int line, int column)
           
 Expression walk(Expression exp)
          Call the walk method of argument Expression.
protected  Expression walkApplyExp(ApplyExp exp)
           
protected  Expression walkBeginExp(BeginExp exp)
           
protected  Expression walkBlockExp(BlockExp exp)
           
protected  Expression walkClassExp(ClassExp exp)
           
 void walkDefaultArgs(LambdaExp exp)
           
protected  Expression walkExitExp(ExitExp exp)
           
protected  Expression walkExpression(Expression exp)
           
 Expression[] walkExps(Expression[] exps)
           
 Expression[] walkExps(Expression[] exps, int n)
          Call walk on the Expressions in an array.
protected  Expression walkFluidLetExp(FluidLetExp exp)
           
protected  Expression walkIfExp(IfExp exp)
           
protected  Expression walkLambdaExp(LambdaExp exp)
           
protected  Expression walkLangExp(LangExp exp)
           
protected  Expression walkLetExp(LetExp exp)
           
protected  Expression walkModuleExp(ModuleExp exp)
           
protected  Expression walkObjectExp(ObjectExp exp)
           
protected  Expression walkQuoteExp(QuoteExp exp)
           
protected  Expression walkReferenceExp(ReferenceExp exp)
           
protected  Expression walkScopeExp(ScopeExp exp)
           
protected  Expression walkSetExp(SetExp exp)
           
protected  Expression walkSynchronizedExp(SynchronizedExp exp)
           
protected  Expression walkThisExp(ThisExp exp)
           
protected  Expression walkTryExp(TryExp exp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpWalker

public ExpWalker()
Method Detail

getCompilation

public Compilation getCompilation()
Get the Compilation associated with this walker.


walkExpression

protected Expression walkExpression(Expression exp)

setContext

public void setContext(Compilation comp)

walk

public Expression walk(Expression exp)
Call the walk method of argument Expression. Could call Expression's walk directly, but this allows us to interpose a method call on each Expression. We use it to note the Expression's line number. Should not need to be overridden; if you do, you may also want to override walkExps.


walkApplyExp

protected Expression walkApplyExp(ApplyExp exp)

walkIfExp

protected Expression walkIfExp(IfExp exp)

walkScopeExp

protected Expression walkScopeExp(ScopeExp exp)

walkLetExp

protected Expression walkLetExp(LetExp exp)

walkLambdaExp

protected Expression walkLambdaExp(LambdaExp exp)

walkClassExp

protected Expression walkClassExp(ClassExp exp)

walkObjectExp

protected Expression walkObjectExp(ObjectExp exp)

walkModuleExp

protected Expression walkModuleExp(ModuleExp exp)

walkSetExp

protected Expression walkSetExp(SetExp exp)

walkTryExp

protected Expression walkTryExp(TryExp exp)

walkBeginExp

protected Expression walkBeginExp(BeginExp exp)

walkQuoteExp

protected Expression walkQuoteExp(QuoteExp exp)

walkReferenceExp

protected Expression walkReferenceExp(ReferenceExp exp)

walkThisExp

protected Expression walkThisExp(ThisExp exp)

walkSynchronizedExp

protected Expression walkSynchronizedExp(SynchronizedExp exp)

walkBlockExp

protected Expression walkBlockExp(BlockExp exp)

walkExitExp

protected Expression walkExitExp(ExitExp exp)

walkFluidLetExp

protected Expression walkFluidLetExp(FluidLetExp exp)

walkLangExp

protected Expression walkLangExp(LangExp exp)

getCurrentLambda

public final LambdaExp getCurrentLambda()

walkExps

public Expression[] walkExps(Expression[] exps)

walkExps

public Expression[] walkExps(Expression[] exps,
                             int n)
Call walk on the Expressions in an array. However, the walk method is inlined for speed.


walkDefaultArgs

public void walkDefaultArgs(LambdaExp exp)

error

public void error(char kind,
                  java.lang.String message)

noteError

public Expression noteError(java.lang.String message)

getFile

public final java.lang.String getFile()

getLine

public final int getLine()

getColumn

public final int getColumn()

setFile

public void setFile(java.lang.String filename)

setLine

public void setLine(int line)

setColumn

public void setColumn(int column)

setLine

public void setLine(java.lang.String filename,
                    int line,
                    int column)