Hi, I am the author of the jhc haskell compiler as well as the frisby
packrat parsing library for haskell.

I would like to parse all of haskell via a packrat parser, generated by
pappy, However, Haskell has a 'layout' rule which is causing some
trouble. basically, in haskell, blocks are defined by layout.

do foo
   bar
   let x = ...
       y = ...
   baz

the 'do' and the 'let' both define a new layout context. I was wondering
if anyone had any ideas on how to extend pappy in order to deal with
this? 

the full specification of the layout rule is here in section 9.3:

http://haskell.org/onlinereport/syntax-iso.html                                 
                       

note that it cannot be carried out purely on the lexical level, as it
depends on matching against a 'parse error' in one of its cases.

adding a primitive that binds to the current column and consumes no
input would be easy, but the "stack of layout contexts" seems to be a
stumbling block.

        John


-- 
John Meacham - ⑆repetae.net⑆john⑈

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to