Closed mantkiew closed 11 years ago
I don't know the layout resolver very well but it seems really basic so I would think this is not possible to do with BNFC directly. But this is what the manual says:
In Haskell, the layout resolver appears, automatically, in its most natural place, which is between the lexer and the parser.
So one way to implement a more sophisticated layout resolver using bnfc would be to write a grammar that understand something like: abstract Person { name : string ; spouse -> Person ? { year : integer } ; child -> Person * }
(i.e. the same language with explicit nesting) and to write your own layout resolver to convert the "sweet" syntax to the one the parser will understand. (Note that I haven't actually tried this)
I'm closing the issue. Please re-open if you are not satisfied with the answer.
What is the status of the layout resolver? It seems it has not been updated since three years ago. It seems to be only limited to having special keywords that open up the nested blocks. In our language, we don't have explicit keyword that mark the beginning of the block. Nesting is simply allowed after each declaration. For example,
Is resolving such layout possible?