fmrisc.Syntax
Class BinaryExpression

java.lang.Object
  extended by fmrisc.Syntax.ASTBase
      extended by fmrisc.Syntax.ExpressionBase
          extended by fmrisc.Syntax.BinaryExpression
All Implemented Interfaces:
AST, Expression
Direct Known Subclasses:
AndFormula, DividesTerm, EqualsFormula, EquivalentFormula, GreaterEqualFormula, GreaterFormula, ImpliesFormula, LessEqualFormula, LessFormula, MinusTerm, NotEqualsFormula, NotEquivalentFormula, OrFormula, PlusTerm, PowerTerm, TimesTerm

public abstract class BinaryExpression
extends ExpressionBase

Abstract base class of binary expressions


Constructor Summary
BinaryExpression(java.lang.String op, Expression first, Expression second)
          constructs binary expression from op, first, and second
 
Method Summary
 AST accept(ASTVisitor visitor)
          Accept visitor for a visit.
abstract  BinaryExpression construct(Expression first, Expression second)
          Construct binary expression of the same kind as this expression.
 Expression getFirst()
          Returns first subexpression
 Expression getSecond()
          Returns second subexpression
 Expression instantiate()
          return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers
 void printCore(java.io.PrintWriter out)
          Prints text representation of tree on out (without new line termination).
 
Methods inherited from class fmrisc.Syntax.ExpressionBase
getPriority, printPriority
 
Methods inherited from class fmrisc.Syntax.ASTBase
print, printParens, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fmrisc.Syntax.AST
print, printParens, toString
 

Constructor Detail

BinaryExpression

public BinaryExpression(java.lang.String op,
                        Expression first,
                        Expression second)
constructs binary expression from op, first, and second

Parameters:
op - the name of the operation used for printing
first - the first operand
second - the second operand
Method Detail

getFirst

public Expression getFirst()
Returns first subexpression

Returns:
the first subexpression

getSecond

public Expression getSecond()
Returns second subexpression

Returns:
the second subexpression

printCore

public void printCore(java.io.PrintWriter out)
Prints text representation of tree on out (without new line termination).

Specified by:
printCore in interface AST
Specified by:
printCore in class ASTBase
Parameters:
out - the stream on which the text is written

instantiate

public Expression instantiate()
return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers

Returns:
the instantiated copy

construct

public abstract BinaryExpression construct(Expression first,
                                           Expression second)
Construct binary expression of the same kind as this expression.

Parameters:
first - an expression.
second - an expression.
Returns:
a binary expression of the same kind as this expression with subexpressions first and second.

accept

public AST accept(ASTVisitor visitor)
Accept visitor for a visit.

Parameters:
visitor - the visitor who is accepted by this node.
Returns:
the result of the visit (may be null).