caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: camlp4 3.10 and ints
Date: Wed, 13 Jun 2007 12:40:47 +0100	[thread overview]
Message-ID: <20070613114043.GA14594@furbychan.cocan.org> (raw)

I'm getting some odd errors with camlp4 (3.10) and integers.

Firstly, INT returns a string, rather than an int, and similarly
$int:...$ expects a string instead of an int.  I can live with this,
but it seems a bit strange, and unless I'm mistaken is different from
what camlp4 <= 3.09 did.

Secondly, I get the error 'Failure: "Integer literal exceeds the range
of representable integers of type int"' if I try to pass a string
containing any int32 or int64 literal, eg. $int:"0x3ffL"$, even ones
which obviously do not exceed the range of representable integers.

To demonstrate this second one, save the following to files:

-------------------------------------------------- pa_test.ml ---
open Camlp4.PreCast
open Syntax

let expand_test _loc () =
  <:str_item< value test = $int:"0x3ffL"$ >>

EXTEND Gram
  GLOBAL: str_item;

  str_item: LEVEL "top" [
  [ "TEST" -> expand_test _loc () ]
  ];
END;;
--------------------------------------------------

-------------------------------------------------- test.ml ---
TEST
--------------------------------------------------

And then compile with:

  $ ocamlc -pp "camlp4o pa_extend.cmo q_MLast.cmo" -I +camlp4 -c pa_test.ml 
  $ ocamlc -pp "camlp4o ./pa_test.cmo" test.ml
  File "test.ml", line 1, characters 0-4:
  Failure: "Integer literal exceeds the range of representable integers of type int"
  Preprocessor error

Are these bugs or am I missing something?

Rich.

-- 
Richard Jones
Red Hat


             reply	other threads:[~2007-06-13 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 11:40 Richard Jones [this message]
2007-06-13 12:17 ` [Caml-list] " Jeremy Yallop
2007-06-13 12:31 ` Nicolas Pouillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070613114043.GA14594@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).