Jared Updike | 4 Jan 23:40 2006
Picon

ByteCode Parser (was YHC build finished successfully...)

>> <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:
(Continue reading)

Neil Mitchell | 5 Jan 15:32 2006
Picon

Re: ByteCode Parser (was YHC build finished successfully...)

Hi Jared,

> check, and it seems to be passing.... I imagine that this
> parser/pretty-printer worked at some point in time, right?

It never worked fully, which is the problem you're hitting. I only
ever tested in on some simple .hbc files. I have attached updated
versions of some files (there was a bug to do with reading signed
bytes as the length of a negative integer which I want to chat about
with Tom, but i've papered over for now).

Hopefully this should get you further, but it still isn't complete.
I'll work on writing a complete bytecode library in the next week.

If this doesn't work with your particular file, then send me the
source and the .hbc file you are working with.

Thanks

Neil
Attachment (lib.zip): application/zip, 7116 bytes
_______________________________________________
Yhc mailing list
Yhc <at> haskell.org
http://haskell.org/mailman/listinfo/yhc
Jared Updike | 5 Jan 22:48 2006
Picon

Re: ByteCode Parser (was YHC build finished successfully...)

> Hopefully this should get you further, but it still isn't complete.
> I'll work on writing a complete bytecode library in the next week.

This code seems to work great on my input HBC file.

I should be able to play with the pretty-printer and try to get some
simple JavaScripts to come out of it. I'll keep you posted on how
things go.

Thanks,
  Jared.

--
jupdike <at> gmail.com
http://www.updike.org/~jared/
reverse ")-:"
Krasimir Angelov | 16 Jan 10:23 2006
Picon

Compiling Prelude.hs

Hello Guys,

While I was playing with YHC, I tried to rebuild Prelude.hs. I saw
that there is a prebuilt version of the entire base package, which is
copied when I do:

$ Makefile.bat lib

I wonder how this bootstrapping version of base was built. When I
tried to do this manually the compiler died with stack overflow.  Is
it because the compiler is tring to import Prelude while compiling
Prelude?

Krasimir
Neil Mitchell | 16 Jan 13:01 2006
Picon

Re: Compiling Prelude.hs

> I wonder how this bootstrapping version of base was built. When I
> tried to do this manually the compiler died with stack overflow.  Is
> it because the compiler is tring to import Prelude while compiling
> Prelude?

Yes, its something like that. There are also problems with recursive
dependancies I believe - things like IO require the Prelude, and the
Prelude requires IO. If you look at the Unix makefile, that really
does try and build them - it also requires the special flag
--unifyhack or something. I believe it also requires modifying the .hi
file by hand as well.

The hope is in future that compiling the Prelude will be as simple as
"yhc Prelude.hs" - but this requires quite a few changes before thats
ready.

Thanks

Neil
Krasimir Angelov | 16 Jan 13:35 2006
Picon

Re: Compiling Prelude.hs

Ok. I tried to replace the bytecode generator in YHC with my own which
is generating .NET code instead of the usual bytecode. I managed to
run my first application for .NET but with some hand written code that
replaces a small part of the base package. What I want is to generate
the right code for base with the compiler. Any advice about how to do
that?

Cheers,
  Krasimir

2006/1/16, Neil Mitchell <ndmitchell <at> gmail.com>:
> > I wonder how this bootstrapping version of base was built. When I
> > tried to do this manually the compiler died with stack overflow.  Is
> > it because the compiler is tring to import Prelude while compiling
> > Prelude?
>
> Yes, its something like that. There are also problems with recursive
> dependancies I believe - things like IO require the Prelude, and the
> Prelude requires IO. If you look at the Unix makefile, that really
> does try and build them - it also requires the special flag
> --unifyhack or something. I believe it also requires modifying the .hi
> file by hand as well.
>
> The hope is in future that compiling the Prelude will be as simple as
> "yhc Prelude.hs" - but this requires quite a few changes before thats
> ready.
>
> Thanks
>
> Neil
(Continue reading)

Neil Mitchell | 16 Jan 17:14 2006
Picon

Re: Compiling Prelude.hs

Wow, way cool. I hope the .NET back end can end up in the main repo as
soon as its done!

The secret to compiling the prelude is using the flags "-c -redefine
-prelude" - if you omit -c it tries to compile in make mode, which
notices that it requires the prelude, which requires the prelude ...
and leads to stack overflow.

Thanks

Neil
Krasimir Angelov | 16 Jan 23:08 2006
Picon

Re: Compiling Prelude.hs

Thanks! It works. I will be happy if the required changes would be
incorporated in the main repo when they are stable.

2006/1/16, Neil Mitchell <ndmitchell <at> gmail.com>:
> Wow, way cool. I hope the .NET back end can end up in the main repo as
> soon as its done!
>
> The secret to compiling the prelude is using the flags "-c -redefine
> -prelude" - if you omit -c it tries to compile in make mode, which
> notices that it requires the prelude, which requires the prelude ...
> and leads to stack overflow.
>
> Thanks
>
> Neil
>
Krasimir Angelov | 16 Jan 23:42 2006
Picon

Re: Compiling Prelude.hs

I found that there are two instances for: Show Char and Enum Char, and
there are two declarations for Bounded class. Is it intentional?

2006/1/17, Krasimir Angelov <kr.angelov <at> gmail.com>:
> Thanks! It works. I will be happy if the required changes would be
> incorporated in the main repo when they are stable.
>
> 2006/1/16, Neil Mitchell <ndmitchell <at> gmail.com>:
> > Wow, way cool. I hope the .NET back end can end up in the main repo as
> > soon as its done!
> >
> > The secret to compiling the prelude is using the flags "-c -redefine
> > -prelude" - if you omit -c it tries to compile in make mode, which
> > notices that it requires the prelude, which requires the prelude ...
> > and leads to stack overflow.
> >
> > Thanks
> >
> > Neil
> >
>
Neil Mitchell | 16 Jan 23:53 2006
Picon

Re: Compiling Prelude.hs

On 16/01/06, Krasimir Angelov <kr.angelov <at> gmail.com> wrote:
> I found that there are two instances for: Show Char and Enum Char, and
> there are two declarations for Bounded class. Is it intentional?

My guess is no, and thats why -redefine is required. However, I know a
lot of bizare internal hackery goes on in the prelude so maybe it is
required...

It doesn't seem to break with it removed, and it shouldn't propagate
through to the back end, so I'll check with Tom and if possible remove
all these bad bits.

Thanks

Neil

Gmane