| [EMAIL PROTECTED] reports the following problem.
|
| Version: 1.3b January 1998
| OS: Linux
| compiler: gcc
| configuration:
| Expected behaviour:
| To parse the Prelude.hs in the distribution.
| Observed behaviour:
| It fails on line 1021:
| Reading script file "/home/patrikj/hugs1.3b/lib/Prelude.hs":
| Parsing
| ERROR "/home/patrikj/hugs1.3b/lib/Prelude.hs" (line 1021): Syntax error in case
|expression (unexpected `)')
| Transcript:
| hugs1.3b
| Code:
| The problem goes away after trivial layout changes to the
| prelude, (there is a complaint on line 1090 too) but the same error
| appears in some program files too.
I used to get almost exactly these kinds of problems when I was first
working on Gofer, and used bison rather than yacc to build the parser.
I believe the problems are caused by incompatabilities in the treatment
of error recovery, but I never managed to track these down to any
formally stated differences in user documentation. Error recovery is
important at the point you have found because it is needed to force the
layout rule to be invoked (as you have verified by changing the layout
by hand). The Hugs parser expects error recovery to work in a
particular way, and if that doesn't happen, then the parser won't
work. (BTW: Since my first encounter with this problem, I've come
across versions of bison that produce working parsers, and versions of
yacc that don't. And I've never found a hint in the user documentation
for any of these parser generators to suggest why the differences might
occur.)
My advice in this situation would be:
- If you can, use the parser.c included in the distribution.
- If you need to make a new parser.c, perhaps because you've changed
the grammar, then try using a different version of yacc (maybe bison -y)
or try running yacc on a different machine.
All the best,
Mark