Commit a08e4369 authored by POTTIER Francois's avatar POTTIER Francois

Check that the (parameterized) symbols mentioned in %type

and %on_error_reduce declarations are well-kinded.
parent 6aaa84d9
File "on-error-reduce-ill-kinded.mly", line 3, characters 17-23:
Error: how is this symbol parameterized?
It is used at sorts * -> * and *.
The sort * -> * is not compatible with the sort *.
%token A B
%start<unit> main
%on_error_reduce phrase
%%
main:
A phrase(B) {}
phrase(X):
X* {}
File "type-ill-kinded.mly", line 3, characters 12-18:
Error: how is this symbol parameterized?
It is used at sorts * -> * and *.
The sort * -> * is not compatible with the sort *.
%token A B
%start<unit> main
%type<unit> phrase (* ill-kinded: phrase is a parameterized nonterminal symbol *)
%%
main:
A phrase(B) A {}
phrase(X):
X* {}
......@@ -441,8 +441,16 @@ let check_grammar (p_grammar : Syntax.grammar) =
check_type();
check_parameters();
check_producers()
)
);
(* Check that every %type and %on_error_reduce declaration mentions a
well-typed term. *)
List.iter (fun (p, _) ->
check_parameter_type env p
) p_grammar.p_types;
List.iter (fun (p, _) ->
check_parameter_type env p
) p_grammar.p_on_error_reduce
let rec subst_parameter subst = function
| ParameterVar x ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment