Followup to a discussion on IRC (freenode, channel `#dynjs).
I have taken on me to kickstart parboiled "1" development again, since it has halted two years ago, and have created grappa.
Basically: you write parsers in Java and create your parser with:
final MyParser parser = Parboiled.createParser(MyParser.class);
This does the following:
- create a
ParserClassNode
containing the bytecode of MyParser
);
- create a name for the new class, since the instance returned is a class inheriting your parser class;
- for each
RuleMethod
in the ParserClassNode
, that is, methods defined in the base class returning a Rule
, perform a given number of transformations; those transformations are defined here.
When you have a look at the classes defined here, what they all do (on the byte code copy) is to generate bytecode which is appended/prepended to the existing method bytecode.
And that is done using raw ASM...
Having googled around, I stumbled upon this library when watching a video on YouTube by the author of JRuby mentioning this library; but I don't see how I can use this library to modify existing bytecode?
An example of what I mean is here.
I know I'll have to modify this code one day (when I go Java 7 I want to go indy); but right now, I am looking for a library which can make it easier for me to generate that kind of "bytecode set", and there are many; a lot more such code extracts are available in the enclosing package. Can JiteScript help me here?