Chimeric syntax

Scott Michel scooter.phd at gmail.com
Tue Apr 28 22:33:45 EDT 2009


On Tue, Apr 28, 2009 at 1:09 PM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> 2009/4/28 Scott Michel <scooter.phd at gmail.com>:
>> This got me to thinking that either ghc has issues or I have some
>> fundamental misunderstanding of Haskell syntax. Or, maybe I should use
>> someone else's grammar.
>
> GHC's parser is over-generous by design. See
> http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Parser. A
> precise description of what is valid Haskell it is certainly NOT, but
> it will certainly accept any valid Haskell program. This may not be
> quite what you want for an IDE - but it might be good enough for a
> first cut.

Actually, given what ghc will accept, I seriously doubt that the LR
grammar can ever successfully translate to a LL(*) grammar. Liberal,
it may be, but it probably should be valid. I just followed the
current parser rules to their ultimate conclusion. I suspect that
people would be quite surprised by what Parser.y.pp will actually
accept.

Basically, my understanding is that a 'let' should not be allowed in a
'class' declaration and yet, ghc is quite happy to allow it. So my
understanding is correct, but ghc grammar is (perhaps) too flexible.


-scooter

PS: Anyone got a multicore Haskell experience they want to share at
Supercomputing this year? The guys from Galois did a great job
shocking the audience last year.


More information about the Glasgow-haskell-users mailing list