Closed andreasabel closed 3 years ago
This parses in haskell but not in a suitable grammar using BNFC's layout mechanism:
layout
f = 5 + g where { g = 3 + h where h = 2 }
The problem seems to be that implicit blocks are dropped from the layout stack without emitting layoutClose tokens, see: https://github.com/BNFC/bnfc/blob/71ebcee11831fab640bb9f39d11c927106d21304/source/src/BNFC/Backend/Haskell/CFtoLayout.hs#L127-L128
layoutClose
I am using this grammar:
layout toplevel; separator nonempty Decl ";" ; Empty. Decl ::= ; FunClause. Decl ::= Ident "=" Expr WhereOpt; layout "where"; YesWhere. WhereOpt ::= "where" "{" [Decl] "}"; NoWhere. WhereOpt ::= ; EId. Expr1 ::= Ident; EInt. Expr1 ::= Integer; EPlus. Expr ::= Expr "+" Expr1; coercions Expr 1;
This parses in haskell but not in a suitable grammar using BNFC's
layout
mechanism:The problem seems to be that implicit blocks are dropped from the layout stack without emitting
layoutClose
tokens, see: https://github.com/BNFC/bnfc/blob/71ebcee11831fab640bb9f39d11c927106d21304/source/src/BNFC/Backend/Haskell/CFtoLayout.hs#L127-L128I am using this grammar: