|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectast.ASTNode
ast.Expr
ast.BinaryExpr
public abstract class BinaryExpr
The abstract BinaryExpr class represents binary expressions whose operands are both expressions (i.e., this does not include assignments, instanceof, etc.). It can be either a comparison expression ('==', '!=', '<', '>', '<=', '>='), an arithmetic expression ('+', '-', '*', '/', '%'), or a boolean expression ('&&', '||'). It contains a lefthand expression and a righthand expression. Subclasses of this class can be handled similarly within the compiler, so most functionality can be implemented in the visitor method for this class.
ASTNode
,
Expr
Field Summary | |
---|---|
protected Expr |
leftExpr
The lefthand expression |
protected Expr |
rightExpr
The righthand expression |
Fields inherited from class ast.ASTNode |
---|
charNum, lineNum, lineStr |
Constructor Summary | |
---|---|
BinaryExpr(int lineNum,
Expr leftExpr,
Expr rightExpr)
BinaryExpr constructor |
Method Summary | |
---|---|
abstract java.lang.Object |
accept(visitor.Visitor v,
java.lang.Object o)
Visitor method |
Expr |
getLeftExpr()
Get the lefthand expression |
abstract java.lang.String |
getOperandType()
Get the operand type (e.g., "int") (must be defined by each subclass) |
abstract java.lang.String |
getOpName()
Get the operation name (e.g., "+") (must be defined by each subclass) |
abstract java.lang.String |
getOpType()
Get the operation type (e.g., "int") (must be defined by each subclass) |
Expr |
getRightExpr()
Get the righthand expression |
Methods inherited from class ast.Expr |
---|
getExprType, setExprType |
Methods inherited from class ast.ASTNode |
---|
getLineNum |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Expr leftExpr
protected Expr rightExpr
Constructor Detail |
---|
public BinaryExpr(int lineNum, Expr leftExpr, Expr rightExpr)
lineNum
- source line number corresponding to this AST nodeleftExpr
- left operand expressionrightExpr
- right operand expressionMethod Detail |
---|
public Expr getLeftExpr()
public Expr getRightExpr()
public abstract java.lang.String getOpName()
public abstract java.lang.String getOpType()
public abstract java.lang.String getOperandType()
public abstract java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
accept
in class Expr
v
- visitor objecto
- object to pass down
Visitor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |