Files
mercury/tests/hard_coded/lexer_bigint.exp2
Julien Fischer e6e295a3cc Generalise the representation of integers in the term module.
In preparation for supporting uint literals and literals for the fixed size
integer types, generalise the representation of integers in the term module, so
that for every integer literal we record its base, value (as an arbitrary
precision integer), signedness and size (the latter two based on the literal's
suffix or lack thereof).

Have the lexer attach information about the integer base to machine sized ints;
we already did this for the 'big_integer' alternative but not the normal one.
In conjunction with the first change, this fixes a problem where the compiler
was accepting non-decimal integers in like arity specifications.  (The
resulting error messages could be improved, but that's a separate change.)

Support uints in more places; mark other places which require further work with
XXX UINT.

library/term.m:
     Generalise the representation of integer terms so that we can store
     the base, signedness and size of a integer along with its value.
     In the new design the value is always stored as an arbitrary precision
     integer so we no longer require the big_integer/2 alternative; delete it.

     Add some utility predicates that make it easier to work with integer terms.

library/term_conversion.m:
library/term_io.m:
     Conform to the above changes,

     Add missing handling for uints in some spots; add XXX UINT comments
     in others -- these will be addressed later.

library/lexer.m:
     Record the base of word sized integer literals.

library/parser.m:
compiler/analysis_file.m:
compiler/fact_table.m:
compiler/get_dependencies.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_util.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/parse_class.m:
compiler/parse_inst_mode_name.m:
compiler/parse_item.m:
compiler/parse_pragma.m:
compiler/parse_sym_name.m:
compiler/parse_tree_out_term.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_defn.m:
compiler/parse_util.m:
compiler/prog_ctgc.m:
compiler/prog_util.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/superhomogeneous.m:
mdbcomp/trace_counts.m:
samples/calculator2.m:
extras/moose/moose.m:
    Conform to the above changes.

tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/lexer_bigint.exp*:
tests/hard_coded/lexer_zero.exp*:
tests/hard_coded/parse_number_from_string.exp*:
tests/hard_coded/term_to_unit_test.exp:
    Update these expected outputs.
2017-04-22 11:53:14 +10:00

52 lines
1.6 KiB
Plaintext

integer(base_10, 2147483646)
integer(base_10, 2147483647)
integer(base_10, 2147483648)
name("-")
integer(base_10, 2147483647)
name("-")
integer(base_10, 2147483648)
name("-")
integer(base_10, 2147483649)
integer(base_2, 4294967295)
integer(base_8, 4294967295)
integer(base_16, 4294967295)
integer(base_10, 9223372036854775807)
big_integer(base_10, i(5, [128, 0, 0, 0, 0]))
big_integer(base_10, i(5, [128, 0, 0, 0, 1]))
name("-")
integer(base_10, 9223372036854775807)
name("-")
big_integer(base_10, i(5, [128, 0, 0, 0, 0]))
name("-")
big_integer(base_10, i(5, [128, 0, 0, 0, 1]))
big_integer(base_2, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_8, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_16, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_10, i(8, [3155, 7268, 4662, 4920, 12374, 12447, 15630, 7857]))
integer(base_10, 2147483646)
integer(base_10, 2147483647)
integer(base_10, 2147483648)
name("-")
integer(base_10, 2147483647)
name("-")
integer(base_10, 2147483648)
name("-")
integer(base_10, 2147483649)
integer(base_2, 4294967295)
integer(base_8, 4294967295)
integer(base_16, 4294967295)
integer(base_10, 9223372036854775807)
big_integer(base_10, i(5, [128, 0, 0, 0, 0]))
big_integer(base_10, i(5, [128, 0, 0, 0, 1]))
name("-")
integer(base_10, 9223372036854775807)
name("-")
big_integer(base_10, i(5, [128, 0, 0, 0, 0]))
name("-")
big_integer(base_10, i(5, [128, 0, 0, 0, 1]))
big_integer(base_2, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_8, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_16, i(5, [255, 16383, 16383, 16383, 16383]))
big_integer(base_10, i(8, [3155, 7268, 4662, 4920, 12374, 12447, 15630, 7857]))