I have the following simple LBNF grammar (it's a fragment, don't try to compile):
ProgDef . Program ::= [FunDec] ;
TypeBit . Type ::= "Bit" ;
position token Var ((lower | '_') (letter | digit | '_' | '\'')*) ;
FunArg . Arg ::= Var ;
separator Arg " " ;
FunDef . Function ::= Var [Arg] "=" Term ;
FunDecl . FunDec ::= Var "::" Type Function ;
separator FunDec "#" ;
When I parse the following source code:
main :: Bit
main = fun1 fun2
#
main :: Bit
main = fun1 fun2
The syntax and parsing work fine. However, I want to get rid of the '#' character separating the function declarations and replace it with an empty line. How can I achieve this?
Here is what worked for me:
layout toplevel ;
ProgDef . Program ::= [FunDec] ;
FunArg . Arg ::= Var ;
separator Arg " " ;
FunDef . Function ::= Var [Arg] "=" Term ;
FunDecl . FunDec ::= Var "::" Type ";" Function ";" ;
separator FunDec "" ;