some bugs in Language.Haskell.Parser
Hal Daume
t-hald@microsoft.com
Sat, 12 Jul 2003 15:08:42 -0700
The program:
> x =3D v where v =3D 2 where
>
> main =3D putStrLn "hello world"
parses as:
> x =3D v=20
> where v =3D 2=20
> main =3D putStrLn "hello world"
which is incorrect.
(in general, the parser can't deal with empty where clauses) as in:
> x =3D 'a' where
> class A a where
this gives a parse error because it's waiting for a real declaration
inside of the first where clause.
it also can't deal with empty statements:
> v =3D do {return 'a';;}
should be accepted but results in a parser error.
in Parser.ly, this essentially boils down to the fact that 'decllist'
must be nonempty, but in certain circumstances (all?), it really *can*
be empty.
the last error (with statements), can be fixed by replacing line
637-639:
> stmtlist :: { [HsStmt] }
> : '{' stmts '}' { $2 }
> | open stmts close { $2 }
with:
> stmtlist :: { [HsStmt] }
> : '{' stmts optsemis '}' { $2 }
> | open stmts optsemis close { $2 }
i believe.
- Hal
--
Hal Daume III | hdaume@isi.edu
"Arrest this man, he talks in maths." | www.isi.edu/~hdaume