Class SourceLine

java.lang.Object
mars.assembler.SourceLine

public class SourceLine extends Object
Handy class to represent, for a given line of source code, the code itself, the program containing it, and its line number within that program. This is used to separately keep track of the original file/position of a given line of code. When .include is used, it will migrate to a different line and possibly different program but the migration should not be visible to the user.
  • Constructor Details

    • SourceLine

      public SourceLine(String source, MIPSprogram mipsProgram, int lineNumber)
      SourceLine constructor
      Parameters:
      source - The source code itself
      mipsProgram - The program (object representing source file) containing that line
      lineNumber - The line number within that program where source appears.
  • Method Details

    • getSource

      public String getSource()
      Retrieve source statement itself
      Returns:
      Source statement as String
    • getFilename

      public String getFilename()
      Retrieve name of file containing source statement
      Returns:
      File name as String
    • getLineNumber

      public int getLineNumber()
      Retrieve line number of source statement
      Returns:
      Line number of source statement
    • getMIPSprogram

      public MIPSprogram getMIPSprogram()
      Retrieve MIPSprogram object containing source statement
      Returns:
      program as MIPSprogram object