[Yhc] ByteCode Parser (was YHC build finished successfully...)

Jared Updike jupdike at gmail.com
Wed Jan 4 17:40:33 EST 2006


>> <wondering out loud>I wonder if Visual J# is a reasonable choice
>> (already installed on my system) or is this a dangerous place to
>> go...</wondering>
>J# is Microsofts version of Java, stay well clear!

I think that's what I was thinking of. I will probably try Venkman/Firefox.

> The API is going to be massively improved - the ultimate idea is to
> write a really good bytecode library, and then have the compiler use
> that one, so people can easily write utilities that operate on .hbc
> files. The library as it stands today has a pretty printer in it,
> tweaking that will probably give you the Javascript output you need
> without too much difficulty.

I got the code from
(http://www.haskell.org//pipermail/yhc/2005-November/000004.html) and
it compiles, but I get a runtime pattern match error on rChar (which
is the character level parser), failing on [], which I take it means
that it's hitting the end of the string and trying to read another
character instead of halting. I don't quite understand all of the code
well enough to try to track this down, but I imagine that maybe the
parser from this API might need to be updated to the newest version of
the bytecode spec? It looks like the loader does a bytecode version
check, and it seems to be passing.... I imagine that this
parser/pretty-printer worked at some point in time, right?

Details (I added a line to print the binary file as a text string):

"HSBC\NUL\SOH\NUL\t\NUL\NUL\NUL\SOH\NUL\f\NUL\EOTmain\NUL\aPrelude\NUL\ESCPrelude.Num.Prelude.Integer\NUL\vfromInteger\NUL\ETXYHC\NUL\bInternal\NUL\a_apply1\NUL\SOH+\NUL\a_apply2\NUL\CANPrelude.Num.Prelude.Show\NUL\ENQprint\NUL\EOTMain\SOH\NUL\v\SOH\NUL\NUL\NULWF\NUL\NUL\EOT\NUL\tA\SOH\NUL\SOH\SOH\NUL\STXl\SOH\ETXF\SOH\NUL\SOH\SOH\NUL\ETXF\STX\NUL\EOT\NUL\ENQ\SOH\NUL\ACKl\SOH\STXF\SOH\NUL\SOH\SOH\NUL\aF\STX\NUL\EOT\NUL\ENQ\SOH\NUL\bF\SOH\NUL\SOH\SOH\NUL\tF\SOH\NUL\SOH\SOH\NUL\n\NUL\DC4\SOH%&\b12)\ENQ\STX12\ENQ\STX45\f67[\NUL"
-- Module:
// name = Main

a.out: ./Binary.hs:63:20-38: Non-exhaustive patterns in lambda

which is at the place in the code where rChar is defined.

rChar :: BinaryRead Char
rChar = BinaryRead (\ (x:xs) -> (x, xs))

   Jared.

--
jupdike at gmail.com
http://www.updike.org/~jared/
reverse ")-:"


More information about the Yhc mailing list