NaBytecode

Class used for storing/constructing bytecode

Constructors

this
this(NaInstruction[] instructionTable)

constructor

Destructor

~this
~this()
Undocumented in source.

Members

Functions

addBookmark
integer addBookmark()

adds a "bookmark" to the last element on stack, so later on, relative to current peek index, bookmark index can be read.

addInstruction
bool addInstruction(string instName, string argument, string error)
bool addInstruction(string instName, string argument)

appends an instruction

addInstructionToTable
bool addInstructionToTable(NaInstruction instruction)

adds an instruction to the instruction table

addJumpPos
void addJumpPos(string name)

adds a jump position

bookmarkRelIndex
integer bookmarkRelIndex(uinteger id)

gets relative index from current stack index to a bookmark

getArgumentsNaData
NaData[] getArgumentsNaData()

Call resolve before this.

getBytecodeCodes
ushort[] getBytecodeCodes()

Call resolve before this or prepare for crashes

getBytecodePointers
void delegate()[] getBytecodePointers()

Call resolve before this or prepare for crashes

getBytecodePretty
string[] getBytecodePretty()
hasInstruction
bool hasInstruction(string name, NaInstruction instruction)
bool hasInstruction(string name)
readByteCode
string[] readByteCode(string[] input)

Reads from a string[] (follows spec/syntax.md)

removeBookmark
bool removeBookmark(uinteger id)

removes a bookmark

resolve
string[] resolve()

goes over bytecode, checks if there are any errors, and converts jump positions to indexes i.e: makes the byte code a bit more ready for execution

Properties

elementCount
uinteger elementCount [@property getter]

Meta