mars.assembler
Class OperandFormat

java.lang.Object
  |
  +--mars.assembler.OperandFormat

public class OperandFormat
extends java.lang.Object

Provides utility method related to MIPS operand formats.


Method Summary
static Instruction bestOperandMatch(TokenList tokenList, java.util.ArrayList instrMatches)
          If candidate operator token matches more than one instruction mnemonic, then select first such Instruction that has an exact operand match.
static boolean tokenOperandMatch(TokenList candidateList, TokenList specList, ErrorList errors)
          Syntax test for correct match in both numbers and types of operands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

tokenOperandMatch

public static boolean tokenOperandMatch(TokenList candidateList,
                                        TokenList specList,
                                        ErrorList errors)
Syntax test for correct match in both numbers and types of operands.

Parameters:
candidateList - List of tokens generated from programmer's MIPS statement.
specList - List of tokens generated from specification for this MIPS instruction.
errors - ErrorList into which any error messages generated here will be added.
Returns:
Returns true if the programmer's statement matches the MIPS specification, else returns false.

bestOperandMatch

public static Instruction bestOperandMatch(TokenList tokenList,
                                           java.util.ArrayList instrMatches)
If candidate operator token matches more than one instruction mnemonic, then select first such Instruction that has an exact operand match. If none match, return the first Instruction and let client deal with operand mismatches.