Question about Haskell lexer and parser.

Arjan van IJzendoorn
Wed, 28 May 2003 12:18:59 +0200


> This rule only applies if there is a parse error on the next token (t).
> [...]
> It does mean that layout processing can't be done entirely in the lexer,

>  Take a look at some of the existing Haskell parsers to
> see how it can be done: [...]

Don't look at Helium. We have a simplified layout rule which can be resolved
in the lexer entirely. You *have to* indent less to close a layout context.
Of course, it doesn't accept complicated usage of the layout rule (e.g. [
case 3 of 3 -> 4, 5]) but the parse errors can be clearer and this kind of
usage is very rare, especially if you don't tell students about the funny
rule above.

Greetings, Arjan