Hi Tommy,

Sorry for the delay replying...

Tommy Thorm <[EMAIL PROTECTED]> writes:
> Hugs reports:
>   ERROR "/udd/thorn/Personal/Haskell/mp3.hs": Module "Main" already loaded
> on a source file, like:
>   data foo = Bar

Yoiks, one of the dangers of putting side-effects in a YACC file is
that it might execute the same code multiple times.  In this case,
Hugs was pretending that it had seen the module heading:

  module Main where

twice - once before it hit the real parse error and once as it
backed up and tried again (for reasons that elude me).

The following patch seems to solve it:

diff -r1.14 parser.y
111c111
< topModule : begin startMain modBody end {
---
> topModule : startMain begin modBody end {

After applying the patch, rebuild Hugs with a line like this:

    bison -y parser.y && mv y.tab.c parser.c && make hugs
    ^^^^^^^^ or yacc

(On my Linux box, byacc produces a broken parser which complains about
a syntax error in case expression in the middle of the Prelude.)


> I still get a corrupted heap after long iteractive usage, but I
> haven't been able to catch it yet.

Sigh, we're still trying to track that one down ourselves. :-(

Alastair

Reply via email to