[Haskell-cafe] Idiomatic way to parse bytecodes

William Yager will.yager at gmail.com
Sun Aug 30 00:22:01 UTC 2015

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 ->

Then, you can convert raw JVM bytecode into some convenient Haskell data,
and then do whatever processing you want to this.


On Sat, Aug 29, 2015 at 6:12 PM, Gautier DI FOLCO <gautier.difolco at gmail.com
> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150829/27d5f6e9/attachment.html>

More information about the Haskell-Cafe mailing list