The assembler utilities allow parsing and assembling an Ethers ASM Dialect source file.
Parse an ethers-format assembly file and return the Abstract Syntax Tree.
Performs assembly of the Abstract Syntax Tree node and return the resulting bytecode representation.
The Disassembler utilities make it easy to convert bytecode into an object which can easily be examined for program structure.
Bytecode inherits Array<Operation>
Each array index represents an operation, collapsing multi-byte operations (i.e. PUSH
) into a single operation.
Get the operation at a given offset into the bytecode. This ensures that the byte at offset is an operation and not data contained within a PUSH
, in which case null it returned.
An Operation is a single command from a disassembled bytecode stream.
The opcode for this Operation.
The offset into the bytecode for this Operation.
If the opcode is a PUSH
, this is the value of that push
Opcode
Create a new instance of an Opcode for a given numeric value (e.g. 0x60 is PUSH1) or mnemonic string (e.g. "PUSH1").
The value (bytecode as a number) of this opcode.
The mnemonic string of this opcode.
The number of items this opcode will consume from the stack.
The number of items this opcode will push onto the stack.
A short description of what this opcode does.
Returns true if the opcode accesses memory.
Returns true if the opcode cannot change state.
Returns true if the opcode is a jumper operation.
Returns 0 if the opcode is not a PUSH*
, or the number of bytes this opcode will push if it is.