
Based on what you've said, I would define a Serial or Binary instance for
single bytecodes, and then use this to write a function :: ByteString ->
[Bytecode].
Then, you can convert raw JVM bytecode into some convenient Haskell data,
and then do whatever processing you want to this.
--Will
On Sat, Aug 29, 2015 at 6:12 PM, Gautier DI FOLCO wrote: Hello all, I have some bytecodes to parse and I look for the most idiomatic way to do
it.
It's mostly JVM Bytecode, long story short, I have some embedded JVM
Bytecodes:
* one part is specification-defined, from 0x00 to 0xB8, differ from the
regular JVM Bytecode
* and the other part is proprietary and changes often I have two main goals:
* print the signification of each bytecodes (a more explicit one than the
hexadecimal value of the bytecode)
* Do some analysis on it, spot patterns, apply markov model on it and so
on. The issue with JVM Bytecode in general is that each bytecode hasn't been
made equal. Some of them requires parameters, some of them modify the
length of the next bytecode, etc.
I'm not looking for a way to parse bytecode quickly, or for a library
doing it for me.
I look for a simple/composable/idiomatic way to do it.
So if you have any thoughts, papers, articles or even code snippets (part
of a library of not) that is done in the Haskell-way, please, share it :) Thanks in advance for your help. _______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe