Class: InstructionParser

InstructionParser(symbols, tokenStream)

new InstructionParser(symbols, tokenStream)

A parser for MIPS instructions and labels
Parameters:
Name Type Description
symbols array An array of pre-defined symbols
tokenStream Parser.TokenStream The stream of tokens to parse
Source:

Methods

parseInstruction() → {Object}

Parse an instruction with its arguments.
Source:
Throws:
Parser.ParseException The instruction must be a valid assembler instruction.
Returns:
A dictionary with 'mnemonic' and 'args' set
Type
Object

parseInstructionLine()

Parse a sequence of optional labels and an optional instruction.
Source:

parseLabel() → {String}

Parse a label
Source:
Returns:
The label name.
Type
String

parseLabels() → {array(Parser.Token)}

Parse a possibly non-empty sequence of labels
Source:
Returns:
The sequence of labels.
Type
array(Parser.Token)

parseLine()

Parse a line
Source:

parseOptionalLabel() → {String|undefined}

Parse an optional label
Source:
Returns:
The label name or undefined, if no label present.
Type
String | undefined

parseSymbolAssignment()

Parse an assignment to a global symbol
Source: