-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Description
With the latest release of menhir that requires type information in the source or inference enabled:
The code back-end now needs type information. This means that either Menhir's type inference mechanism must be enabled (the easiest way of enabling it is to use Menhir via dune and to check that the dune-project file says (using menhir 2.0) or later) or the type of every nonterminal symbol must be explicitly given via a %type declaration.
The menhir backend for BNFC currently fails as follows:
❯ cat > Sum.cf
EInt. Exp ::= Integer;
EPlus. Exp ::= Exp "+" Integer;
/tmp
❯ bnfc -m Sum.cf --ocaml-menhir && make
2 rules accepted
writing new file ./AbsSum.ml
writing new file ./LexSum.mll
writing new file ./ParSum.mly
writing new file ./SkelSum.ml
writing new file ./PrintSum.ml
writing new file ./ShowSum.ml
writing new file ./TestSum.ml
writing new file ./BNFC_Util.ml
writing new file ./Makefile
menhir ParSum.mly
File "ParSum.mly", line 14, characters 14-22:
Warning: the token TOK_Char is unused.
File "ParSum.mly", line 15, characters 15-25:
Warning: the token TOK_Double is unused.
File "ParSum.mly", line 13, characters 16-25:
Warning: the token TOK_Ident is unused.
File "ParSum.mly", line 17, characters 16-26:
Warning: the token TOK_String is unused.
Error: the code back-end requires the type of every nonterminal symbol to be
known. Please specify the type of every symbol via %type declarations, or
enable type inference (look up --infer in the manual).
Type inference is automatically enabled when Menhir is used via Dune,
provided the dune-project file says (using menhir 2.0) or later.
The types of the following nonterminal symbols are unknown:
exp
int
make: *** [all] Error 1
/tmp