I have added utility/num.js and utility/tests/num.js which implement infinite precision integers. The "num" abstract type is represented as the union of the JavaScript integer representation and the bignum representation. I also modified the scanner to use the "num" type when computing the integer value. Here's the code for reference:
var lhs_value = function (accepted_char, base, char_value) { var n = 0; for (;;) { var c = that.lookahead_char(0); if (!accepted_char(c)) break; that.advance(1); n = num_add(num_mul(n, base), char_value(c)); } return n; };
The arithmetic functions on the "num" type are all prefixed with num_ (in particular: num_add, num_sub, num_mul, num_div, num_mod, num_lt, num_eq, num_gt, num_neg, num_not, num_and, num_or, num_xor, num_shift, num_to_string).
The compiler's code, in particular the constant folding and the back-end, will have to use these functions when manipulating integers that may exceed the 30 bit fixnum range. Please make the appropriate modifications. For example, instead of doing a test like x > 2147483647 (the literal is 2^31-1), do this instead: num_gt(x, num_sub(num_shift(1, 31), 1)). Of course it would be best to compute num_sub(num_shift(1, 31), 1) once.
I have reactivated the warning for 30 bit integers in the parser to help identify the problem spots.
Marc