avrora.syntax
Class SyntacticOperand

java.lang.Object
  extended byavrora.syntax.ASTNode
      extended byavrora.syntax.SyntacticOperand
All Implemented Interfaces:
Operand
Direct Known Subclasses:
SyntacticOperand.Expr, SyntacticOperand.Register

public abstract class SyntacticOperand
extends ASTNode
implements Operand

The SyntacticOperand class is an implementation of the avrora.core.Operand interface that corresponds to source assembly programs. Therefore instances of this class contain Tokens that tie them back to their original locations in the source assembly. This is useful for reporting assembly errors when the prototype fails to build an instruction because the operands do not meet the constraints specified in the Atmel instruction set reference.

See Also:
Operand, InstrPrototype

Nested Class Summary
static class SyntacticOperand.Expr
          The SyntacticOperand.Expr class represents a constant expression that was specified in the source assembly as an expression.
static class SyntacticOperand.Register
          The SyntacticOperand.Register class represents a register operand at the source level.
 
Nested classes inherited from class avrora.core.Operand
Operand.Constant
 
Field Summary
protected  AbstractToken left
           
protected  AbstractToken right
           
 
Method Summary
 Operand.Constant asConstant()
          The asConstant() method uses virtual dispatch to avoid a cast.
 Operand.Register asRegister()
          The asRegister() method uses virtual dispatch to avoid a cast.
 AbstractToken getLeftMostToken()
          The getLeftMostToken() method gets the first token associated with the abstract syntax tree node.
 AbstractToken getRightMostToken()
          The getRightMostToken() method gets the last token associated with the abstract syntax tree node.
abstract  void simplify(int nextByteAddress, Context c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

left

protected final AbstractToken left

right

protected final AbstractToken right
Method Detail

simplify

public abstract void simplify(int nextByteAddress,
                              Context c)

getLeftMostToken

public AbstractToken getLeftMostToken()
Description copied from class: ASTNode
The getLeftMostToken() method gets the first token associated with the abstract syntax tree node.

Specified by:
getLeftMostToken in class ASTNode
Returns:
an AbstractToken instance representing the first token that is a part of this syntactic item.

getRightMostToken

public AbstractToken getRightMostToken()
Description copied from class: ASTNode
The getRightMostToken() method gets the last token associated with the abstract syntax tree node.

Specified by:
getRightMostToken in class ASTNode
Returns:
an AbstractToken instance representing the last token that is a part of this syntactic item.

asRegister

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

Specified by:
asRegister in interface Operand
Returns:
this if this is an instance of Operand.Register; null otherwise

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
Returns:
this if this is an instance of Operand.Constant; null otherwise