I have the following BNFC code:
GFDefC. GoalForm ::= Constraint ;
GFDefT. GoalForm ::= True ;
GFDefA. GoalForm ::= GoalForm "," GoalForm ;
GFDefO. GoalForm ::= GoalForm ";" GoalForm ;
ConFr. Constraint ::= Var "#" Term ;
TVar. Term ::= UnVar;
TFun. Term ::= Fun ;
FDef. Fun ::= FunId "(" [Arg] ")" ;
ADecl. Arg ::= Term ;
separator Arg "," ;
...
However, the following is not parsed
fun(X)
while it parses the one below
x # fun(Y)
so to sum up, it parses the function as a part of constraints, but not individually. It should parse both of them.
Could anyone point out why?
You should set your
entrypointsproperly.As you're parsing
x # fun(Y)successfully, I assume you have set yourentrypointstoConstraintand using the generatedpConstraintfunction to parse your expressions. Then, you can change your rules ofConstrainttoAternatively, you can add
Termto yourentrypointsand invokepTermto parse your function terms.