Package mars.assembler
Class TokenTypes
java.lang.Object
mars.assembler.TokenTypes
Constants to identify the types of tokens found in MIPS programs. If Java had
enumerated types, that's how these would probably be implemented.
- Version:
- August 2003
- Author:
- Pete Sanderson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesstatic TokenTypesNote: REGISTER_NAME is token of form $zero whereas REGISTER_NUMBER is token of form $0.static TokenTypesstatic TokenTypesstatic String -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisFloatingTokenType(TokenTypes type)Lets you know if given TokenType is for floating point numbers (REAL_NUMBER).static booleanisIntegerTokenType(TokenTypes type)Lets you know if given TokenType is for integers (INTGER_5, INTEGER_16, INTEGER_32).static booleanisValidIdentifier(String value)static TokenTypesmatchTokenType(String value)Classifies the given token into one of the MIPS types.toString()Produces String equivalent of this token type, which is its name.
-
Field Details
-
TOKEN_DELIMITERS
- See Also:
- Constant Field Values
-
COMMENT
-
DIRECTIVE
-
OPERATOR
-
DELIMITER
-
REGISTER_NAME
Note: REGISTER_NAME is token of form $zero whereas REGISTER_NUMBER is token of form $0. The former is part of extended assembler, and latter is part of basic assembler. -
REGISTER_NUMBER
-
FP_REGISTER_NAME
-
IDENTIFIER
-
LEFT_PAREN
-
RIGHT_PAREN
-
INTEGER_5
-
INTEGER_16
-
INTEGER_16U
-
INTEGER_32
-
REAL_NUMBER
-
QUOTED_STRING
-
PLUS
-
MINUS
-
COLON
-
ERROR
-
MACRO_PARAMETER
-
-
Method Details
-
toString
Produces String equivalent of this token type, which is its name. -
matchTokenType
Classifies the given token into one of the MIPS types.- Parameters:
value- String containing candidate language element, extracted from MIPS program.- Returns:
- Returns the corresponding TokenTypes object if the parameter matches
a defined MIPS token type, else returns
null.
-
isIntegerTokenType
Lets you know if given TokenType is for integers (INTGER_5, INTEGER_16, INTEGER_32).- Parameters:
type- the TokenType of interest- Returns:
- true if type is an integer type, false otherwise.
-
isFloatingTokenType
Lets you know if given TokenType is for floating point numbers (REAL_NUMBER).- Parameters:
type- the TokenType of interest- Returns:
- true if type is an floating point type, false otherwise.
-
isValidIdentifier
-