org.millscript.millscript.expr
Class BinaryOpExpr<A extends Action>

java.lang.Object
  extended by org.millscript.millscript.expr.Expr<A>
      extended by org.millscript.millscript.expr.BinaryOpExpr<A>
All Implemented Interfaces:
OneResult
Direct Known Subclasses:
AppendExpr, ArithExpr, FnCompExpr

public abstract class BinaryOpExpr<A extends Action>
extends Expr<A>
implements OneResult

This class represents binary opereration syntax. A binary operation is one which returns a single result, from two single inputs. This means the left and right hand side expressions must produce single results, and that the expression as a whole will return a single result.

See Also:
AppendExpr, BinaryOpAction

Constructor Summary
BinaryOpExpr(Expr<?> a, Expr<?> b)
          Creates a new binary operation expression with the specified left and right hand side expressions.
 
Method Summary
 A compileIt()
          Compiles this expression into an action.
abstract  A newAction(Action a, Action b)
          Compiles this expression into an action.
 void resolve(CompilerState state)
          Resolves any NameExpr in the tree so that they refer to the correct ident.
 
Methods inherited from class org.millscript.millscript.expr.Expr
arity, compile, isIntegerExpr, resolveList, setLineNumber, setOrigin, show, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryOpExpr

public BinaryOpExpr(Expr<?> a,
                    Expr<?> b)
Creates a new binary operation expression with the specified left and right hand side expressions.

Parameters:
a - the left hand side expression, which must return a single result
b - the right hand side expression, which must return a single result
Method Detail

compileIt

public final A compileIt()
Description copied from class: Expr
Compiles this expression into an action.

Specified by:
compileIt in class Expr<A extends Action>
Returns:
the Action for this expression
See Also:
Expr.compileIt()

newAction

public abstract A newAction(Action a,
                            Action b)
Compiles this expression into an action. This is method performs the expression specific compilation, but does not need to handle the left and right hand side expression compilation.

Parameters:
a - the compiled left hand side expression
b - the compiled right hand side expression
Returns:
the Action for this expression
See Also:
compileIt()

resolve

public void resolve(CompilerState state)
Description copied from class: Expr
Resolves any NameExpr in the tree so that they refer to the correct ident. e.g. This method is responsible for ensuring that references to a function argument in the body of a function actually refer to the correct value.

Specified by:
resolve in class Expr<A extends Action>
Parameters:
state - the compiler state we are resolving in
See Also:
Expr.resolve(org.millscript.millscript.vm.CompilerState)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.