Manuel Chakravarty writes:
 
> What kind of implementation did the originators of this
> clause envision?  If the layout rule is really implemented
> as a filter between the scanner and the parser, it seems
> extremely awkward to add a dependency on the error condition
> of the parser - in particular, it makes a functional, ie,
> side-effect free implementation rather hard and a true two
> phase implementation impossible.

Simon Marlow replies:

> GHC and Hugs both make use of yacc-style error recovery, albeit in a very
> limited form.

And nhc uses parser combinators, which give you backtracking on error
conditions for free.  We actually do almost all layout processing at
the lexical stage, but where the parser expects a } and doesn't get
one, we just insert the }, and re-lex the remaining input.  I suppose
having to re-lex is a bit of a chore, but laziness comes to the rescue
somewhat.

Regards,
    Malcolm



Reply via email to