Does BNFC support the symbol '|'?

46 Views Asked by At

There is a simple example in BNFC's documentation.

Char_a. Char ::= "a" ;
Char_b. Char ::= "b" ;

I try to rewrite it by using union |

Char_a.  Char ::= "a" | "b" ;

but then in this case I got an error bnfc: user error (syntax error at line 1 before | b ;)

It seems that BNFC really not likes |. However, I find | can be used in rules statement.

rules Boolen ::= "True" | "False"; this can be compiled successfully. So I would like to know the reason for the error in my rewriting and where the union symbol can be used.

0

There are 0 best solutions below