[m-rev.] for review: read min_int
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon May 14 13:28:26 AEST 2012
On Fri, 11 May 2012, Peter Wang wrote:
> Branches: main
>
> lexer.m tokenises "-INTEGER" as two tokens, a minus sign and a positive
> integer. This fails when the overall negative value is min_int, i.e. the
> absolute value is max_int+1 -- too big to store in an int.
>
> One less obvious consequence of the bug is that io.read could not parse some
> plain Mercury terms written out by io.write.
>
> library/lexer.m:
> Add a `token.big_integer' constructor to hold big integer literals in
> their string representation. Currently this is only done for base 10
> literals which cannot fit in an int.
>
> library/parser.m:
> Parse the token sequence, minus sign followed by big_integer max_int+1,
> as the integer term with value min_int.
>
> tests/hard_coded/Mmakefile:
> tests/hard_coded/lexer_bigint.exp:
> tests/hard_coded/lexer_bigint.exp2:
> tests/hard_coded/lexer_bigint.inp:
> tests/hard_coded/lexer_bigint.m:
> tests/hard_coded/read_min_int.exp:
> tests/hard_coded/read_min_int.exp2:
> tests/hard_coded/read_min_int.inp:
> tests/hard_coded/read_min_int.m:
> Add test cases.
That looks fine -- please also add a brief entry to the NEWS file for
this as well.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list