lambdapi icon indicating copy to clipboard operation
lambdapi copied to clipboard

Improving understanding of error `Uncaught [(Failure int_of_string)]`

Open amelieled opened this issue 2 years ago • 2 comments

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.

amelieled avatar Sep 14 '22 05:09 amelieled

It seems to be the case, even in plain OCaml, int_of_string "9223372036854775808" fails.

gabrielhdt avatar Sep 14 '22 06:09 gabrielhdt

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?

francoisthire avatar Sep 14 '22 06:09 francoisthire