lambdapi
lambdapi copied to clipboard
Improving understanding of error `Uncaught [(Failure int_of_string)]`
This LP file:
symbol SortK : TYPE;
symbol δ : SortK → TYPE;
symbol SortInt : SortK;
symbol zero : δ SortInt;
symbol succ : δ SortInt → δ SortInt;
builtin "0" ≔ zero;
builtin "+1" ≔ succ;
symbol A : δ SortInt;
rule A ↪ 9223372036854775808;
generates the error:
Uncaught [(Failure int_of_string)]
probably because 9223372036854775808
is too long.
It seems to be the case, even in plain OCaml, int_of_string "9223372036854775808"
fails.
That's the point of the issue. The error should be wrapped properly by Lambdapi
so that an error message such as: "too long natural number. Maximum supported is: <max_int>".
I wonder whether this problem can arise too during pretty printing (or worst during type checking) if we evaluate the successor of the maximum integer representable?