Abstract Syntax Tree (package tree.ast)
A contextually aware extension for the tree package.
The majority of instructions (NOP excluded) play with the stack and thus have a
relationship with previous instructions. For the purpose of extensibility, tree
should offer some form of the Node complex which is aware of the instructions
that directly affect its functionality.
For example, presented with the given code fragment
ALOAD_1
GETFIELD a.b I
ICONST_M1
ICONST_M1
IXOR
IF_ICMPEQ
And when visiting IF_ICMPEQ, having an abstract means of doing something like
"IF_ICMPEQ.getComparisonRight()" which would return a "Statement", a chunk of
instructions, equivelant to
ICONST_M1
ICONST_M1
IXOR
Where ".getComparisonLeft()" would return
ALOAD_1
GETFIELD a.b I
And so on. Other functionality could included MethodInsnStatement, which has
awareness such as "getArgument(int index)", and "getInstance()". A "remove"
function which drops the Node and its context from the InsnList... The
Statement class is a possible abstract super class, with a special "InsnList"
that instead of containing Nodes contains a series of linked Statements.
Frame's could be calculated on a Statement basis.
The functionality such a package would provide is boundless.
Very Respectfully,
Jay