Parsing a file using the Ethers ASM Dialect will generate an Abstract Syntax Tree. The root node will always be a ScopeNode whose name is _
.
To parse a file into an Abstract Syntax tree, use the parse function.
The offset into the source code to the start of this node.
The length of characters in the source code to the end of this node.
The source code of this node.
@TODO: Place a diagram here showing the hierarchy
Node
A unique tag for this node for the lifetime of the process.
The source code and location within the source code that this node represents.
A ValueNode is a node which may manipulate the stack.
The literal value of this node, which may be a DataHexString or string of a decimal number.
This is true in a DataNode context, since in that case the value should be taken verbatim and no PUSH
operation should be added, otherwise false.
A PopNode is used to store a place-holder for an implicit pop from the stack. It represents the code for an implicit place-holder (i.e. $$
) or an explicit place-holder (e.g. $1
), which indicates the expected stack position to consume.
The index this PopNode is representing. For an implicit place-holder this is 0
.
A LinkNode represents a link to another Node's data, for example $foo
or #bar
.
The name of the target node.
Whether this node is for an offset or a length value of the target node.
The opcode for this Node.
A list of all operands passed into this Node.
An EvaluationNode is used to execute code and insert the results but does not generate any output assembly, using the {{! code here }}
syntax.
This is true in a DataNode context, since in that case the value should be taken verbatim and no PUSH
operation should be added, otherwise false.
The code to evaluate and produce the result to use as a literal.
An ExecutionNode is used to execute code but does not generate any output assembly, using the {{! code here }}
syntax.
The code to execute. Any result is ignored.
A LabelledNode is used for any Node that has a name, and can therefore be targeted by a LinkNode.
The name of this node.
LabelNode inherits LabelledNode
A LabelNode is used as a place to JUMP
to by referencing it name, using @myLabel:
. A JUMPDEST
is automatically inserted at the bytecode offset.
DataNode inherits LabelledNode
A DataNode allows for data to be inserted directly into the output assembly, using @myData[ ... ]
. The data is padded if needed to ensure values that would otherwise be regarded as a PUSH
value does not impact anything past the data.
The child nodes, which each represent a verbatim piece of data in insert.
ScopeNode inherits LabelledNode
A ScopeNode allows a new frame of reference that all LinkNode's will use when resolving offset locations, using @myScope{ ... }
.
The list of child nodes for this scope.