[Haskell-cafe] Idiomatic way to parse bytecodes

Kim-Ee Yeoh ky3 at atamo.com
Sun Aug 30 03:46:40 UTC 2015


On Sun, Aug 30, 2015 at 6:12 AM, Gautier DI FOLCO <gautier.difolco at gmail.com
> wrote:


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

Work backwards, a piece at a time.

The output of parsing is a piece of structured data. So you need to design
your data type. Start with the bare minimum. Write the pretty printing
code. What do the type signatures of your analysis functions look like?

E.g. "Apply markov model" is way too vague.

The key thing is to iterate and improve on the design of your data type.

Once the data type looks good, the implementation of parsing becomes clear
as day.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150830/7c85cc50/attachment.html>


More information about the Haskell-Cafe mailing list