avrora.syntax
Class SyntacticOperand.Expr

java.lang.Object
  extended byavrora.syntax.ASTNode
      extended byavrora.syntax.SyntacticOperand
          extended byavrora.syntax.SyntacticOperand.Expr
All Implemented Interfaces:
Operand, Operand.Constant
Enclosing class:
SyntacticOperand

public static class SyntacticOperand.Expr
extends SyntacticOperand
implements Operand.Constant

The SyntacticOperand.Expr class represents a constant expression that was specified in the source assembly as an expression. This expression might be compound and need to be evaluated before its actual value is known.


Nested Class Summary
 
Nested classes inherited from class avrora.syntax.SyntacticOperand
SyntacticOperand.Expr, SyntacticOperand.Register
 
Nested classes inherited from class avrora.core.Operand
Operand.Constant, Operand.Register
 
Field Summary
 Expr expr
           
 
Fields inherited from class avrora.syntax.SyntacticOperand
left, right
 
Constructor Summary
SyntacticOperand.Expr(Expr e, boolean b)
           
 
Method Summary
 Operand.Constant asConstant()
          The asConstant() method uses virtual dispatch to avoid a cast.
 int getValue()
          The getvalue() method returns the integer value of this constant operand.
 int getValueAsWord()
          The getValueAsWord() method returns the value of this constant operand as word-aligned; meaning, for addresses, it will divide by 2, but for immediate constants it will not.
 void simplify(int nextByteAddress, Context c)
           
 java.lang.String toString()
           
 
Methods inherited from class avrora.syntax.SyntacticOperand
asRegister, getLeftMostToken, getRightMostToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface avrora.core.Operand
asRegister
 

Field Detail

expr

public final Expr expr
Constructor Detail

SyntacticOperand.Expr

public SyntacticOperand.Expr(Expr e,
                             boolean b)
Method Detail

asConstant

public Operand.Constant asConstant()
Description copied from interface: Operand
The asConstant() method uses virtual dispatch to avoid a cast. If this operand is an instance of Operand.Constant it will return itself. Otherwise, it will return null.

Specified by:
asConstant in interface Operand
Overrides:
asConstant in class SyntacticOperand

getValue

public int getValue()
Description copied from interface: Operand.Constant
The getvalue() method returns the integer value of this constant operand.

Specified by:
getValue in interface Operand.Constant
Returns:
an integer representation of the value

getValueAsWord

public int getValueAsWord()
Description copied from interface: Operand.Constant
The getValueAsWord() method returns the value of this constant operand as word-aligned; meaning, for addresses, it will divide by 2, but for immediate constants it will not.

Specified by:
getValueAsWord in interface Operand.Constant
Returns:
an integer representation of the value, word-aligned if it is an address

simplify

public void simplify(int nextByteAddress,
                     Context c)
Specified by:
simplify in class SyntacticOperand

toString

public java.lang.String toString()