|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.ProgramStatement
public class ProgramStatement
Represents one assembly/machine statement. This represents the "bare machine" level. Pseudo-instructions have already been processed at this point and each assembly statement generated by them is one of these.
Constructor Summary | |
---|---|
ProgramStatement(int binaryStatement,
int textAddress)
Constructor for ProgramStatement used only for writing a binary machine instruction with no source code to refer back to. |
|
ProgramStatement(MIPSprogram sourceMIPSprogram,
String source,
TokenList origTokenList,
TokenList strippedTokenList,
Instruction inst,
int textAddress,
int sourceLine)
Constructor for ProgramStatement when there are links back to all source and token information. |
Method Summary | |
---|---|
void |
buildBasicStatementFromBasicInstruction(ErrorList errors)
Given specification of BasicInstruction for this operator, build the corresponding assembly statement in basic assembly format (e.g. |
void |
buildMachineStatementFromBasicStatement(ErrorList errors)
Given the current statement in Basic Assembly format (see above), build the 32-bit binary machine code statement. |
int |
getAddress()
Produces Text Segment address where the binary machine statement is stored. |
String |
getBasicAssemblyStatement()
Produces Basic Assembly statement for this MIPS source statement. |
int |
getBinaryStatement()
Produces 32-bit binary machine statement as int. |
Instruction |
getInstruction()
Produces Instruction object corresponding to this statement's operator. |
String |
getMachineStatement()
Produces binary machine statement as 32 character string, all '0' and '1' chars. |
int |
getOperand(int i)
Produces operand value from given array position (first operand is position 0). |
int[] |
getOperands()
Produces int array of operand values for this statement. |
TokenList |
getOriginalTokenList()
Produces token list generated from original source statement. |
String |
getPrintableBasicAssemblyStatement()
Produces printable Basic Assembly statement for this MIPS source statement. |
String |
getSource()
Produces MIPS source statement. |
String |
getSourceFile()
Produces String name of the source file containing this statement. |
int |
getSourceLine()
Produces line number of MIPS source statement. |
MIPSprogram |
getSourceMIPSprogram()
Produces MIPSprogram object representing the source file containing this statement. |
TokenList |
getStrippedTokenList()
Produces token list stripped of all but operator and operand tokens. |
void |
setBasicAssemblyStatement(String statement)
Assigns given String to be Basic Assembly statement equivalent to this source line. |
void |
setBinaryStatement(int binaryCode)
Assigns given int to be binary machine code equivalent to this source line. |
void |
setMachineStatement(String statement)
Assigns given String to be binary machine code (32 characters, all of them 0 or 1) equivalent to this source line. |
void |
setSource(String src)
associates MIPS source statement. |
String |
toString()
Crude attempt at building String representation of this complex structure. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProgramStatement(MIPSprogram sourceMIPSprogram, String source, TokenList origTokenList, TokenList strippedTokenList, Instruction inst, int textAddress, int sourceLine)
sourceMIPSprogram
- The MIPSprogram object that contains this statementsource
- The corresponding MIPS source statement.origTokenList
- Complete list of Token objects (includes labels, comments, parentheses, etc)strippedTokenList
- List of Token objects with all but operators and operands removed.inst
- The Instruction object for this statement's operator.textAddress
- The Text Segment address in memory where the binary machine code for this statement
is stored.public ProgramStatement(int binaryStatement, int textAddress)
binaryStatement
- The 32-bit machine code.textAddress
- The Text Segment address in memory where the binary machine code for this statement
is stored.Method Detail |
---|
public void buildBasicStatementFromBasicInstruction(ErrorList errors)
errors
- The list of assembly errors encountered so far. May add to it here.public void buildMachineStatementFromBasicStatement(ErrorList errors)
errors
- The list of assembly errors encountered so far. May add to it here.public String toString()
toString
in class Object
public void setBasicAssemblyStatement(String statement)
statement
- A String containing equivalent Basic Assembly statement.public void setMachineStatement(String statement)
statement
- A String containing equivalent machine code.public void setBinaryStatement(int binaryCode)
binaryCode
- An int containing equivalent binary machine code.public void setSource(String src)
src
- a MIPS source statement.public MIPSprogram getSourceMIPSprogram()
public String getSourceFile()
public String getSource()
public int getSourceLine()
public String getBasicAssemblyStatement()
public String getPrintableBasicAssemblyStatement()
public String getMachineStatement()
public int getBinaryStatement()
public TokenList getOriginalTokenList()
public TokenList getStrippedTokenList()
public Instruction getInstruction()
public int getAddress()
public int[] getOperands()
public int getOperand(int i)
i
- Operand position in array (first operand is position 0).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |