[m-dev.] lexing min_int

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 24 16:32:02 AEDT 2012

Hi Peter,

On Wed, 18 Jan 2012, Peter Wang wrote:

> I was trying to serialise a structure with io.write and reading it back
> with io.read.  The latter part fails when the structure (sparse_bitset
> in my case) contains an integer with value min_int.  That is written as
> a negative decimal integer but is lexed as a minus sign followed by a
> positive integer which is one bigger than max_int.
> The best solution I can think of is to make lexer.m treat the most
> negative integer literal as a special case, and return it as a single
> token.integer token with a negative value.
> Any other suggestions?

An alternative (although quite disruptive in terms of its impact on
existing code) would be to change the integer/1 constructor of the
token/0 type to be an arbitrary precision integer or a string.

mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au

More information about the developers mailing list