[messages] better comment and errors

This commit is contained in:
Arnaud DABY-SEESARAM 2022-12-20 16:41:21 +01:00
parent 03def2ce1a
commit a673c447e3
2 changed files with 10 additions and 10 deletions

View File

@ -319,8 +319,8 @@ and cp_expression fmt (expr, hloc) =
(** [cp_main] tries to print a main function to the C code. (** [cp_main] prints a main function to the C code if necessary:
* If there is a function [main] in the lustre program, it will generate a main * if there is a function [main] in the lustre program, it will generate a main
* function in the C code, otherwise it does not do anything. * function in the C code, otherwise it does not do anything.
*) *)
let cp_main_fn fmt (prog, sts) = let cp_main_fn fmt (prog, sts) =

View File

@ -216,8 +216,8 @@ node_content:
if vars_distinct e_in e_out (snd $10) if vars_distinct e_in e_out (snd $10)
then (Hashtbl.add defined_nodes node_name n; n) then (Hashtbl.add defined_nodes node_name n; n)
else raise (MyParsingError else raise (MyParsingError
("There is a conflict between the names of local, input \ ("There is a conflict between the names of local,\
or output variables.", input or output variables.",
current_location())) current_location()))
end}; end};
@ -324,22 +324,22 @@ expr:
"Addition expects both arguments to be (the same kind of) numbers." } "Addition expects both arguments to be (the same kind of) numbers." }
| expr MINUS expr | expr MINUS expr
{ make_binop_nonbool $1 $3 BOp_sub { make_binop_nonbool $1 $3 BOp_sub
"You should know better; subtraction hates booleans" } "Substraction expects both arguments to be (the same kind of) numbers." }
| expr BO_mul expr | expr BO_mul expr
{ make_binop_nonbool $1 $3 BOp_mul { make_binop_nonbool $1 $3 BOp_mul
"You should know better; multiplication hates booleans" } "Multiplication expects both arguments to be (the same kind of) numbers." }
| expr BO_div expr | expr BO_div expr
{ make_binop_nonbool $1 $3 BOp_div { make_binop_nonbool $1 $3 BOp_div
"You should know better; division hates booleans" } "Division expects both arguments to be (the same kind of) numbers." }
| expr BO_mod expr | expr BO_mod expr
{ make_binop_nonbool $1 $3 BOp_mod { make_binop_nonbool $1 $3 BOp_mod
"You should know better; modulo hates booleans" } "Modulo expects both arguments to be numbers." }
| expr BO_and expr | expr BO_and expr
{ make_binop_bool $1 $3 BOp_and { make_binop_bool $1 $3 BOp_and
"You should know better; conjunction hates numbers" } "Conjunction expects both arguments to be booleans." }
| expr BO_or expr | expr BO_or expr
{ make_binop_bool $1 $3 BOp_or { make_binop_bool $1 $3 BOp_or
"You should know better; disjunction hates numbers" } "Disjunction expects both arguments to be booleans." }
| expr BO_arrow expr | expr BO_arrow expr
{ let e1 = $1 in let t1 = type_exp e1 in { let e1 = $1 in let t1 = type_exp e1 in
let e2 = $3 in let t2 = type_exp e2 in let e2 = $3 in let t2 = type_exp e2 in