From: Richard Jones <rich@annexia.org>
To: Jeremy Yallop <jeremy.yallop@ed.ac.uk>
Cc: Nicolas Pouillard <nicolas.pouillard@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] Custom lexer in Camlp4
Date: Tue, 24 Jun 2008 16:16:26 +0100 [thread overview]
Message-ID: <20080624151626.GA8424@annexia.org> (raw)
In-Reply-To: <486104FF.1080201@ed.ac.uk>
On Tue, Jun 24, 2008 at 03:30:23PM +0100, Jeremy Yallop wrote:
> Ok, I've built a slightly modified clone of PreCast. What's the best
> way to persuade Camlp4 to use it? The original PreCast seems fairly
> hardwired, e.g. in the Register module.
If you get an answer to this, please post it. I would love to be able
to add new integer literals to the language (0UL and so on).
On a related note I had a crazy brainwave that we could use camlp4 to
use 'ordinary' operators in an overloaded context. Something like:
INT64 (2L * n / 3L)
The INT64(expr) macro would inspect the AST of expr and change + ->
Int64.add etc. Of course one can do this using the pa_openin macro
and a module which overrides (+) etc, but maybe this is better? I was
going to try modifying parts of virt-df to use this syntax to see if
it would be beneficial.
After writing virt-df which uses mixed int64, int32, int and int63[*]
types I'm starting to come around to Jon's opinion that some limited
overloading or type classes or whatever would be worthwhile.
Rich.
[*] int63 is my own type: It turns into an efficient int on 64 bit
platforms, and is emulated on (now rare) 32 bit platforms. It is
necessary for virt-df because we want ints which can comfortably hold
the size (in bytes / sectors / blocks / etc) of a block device. You
don't really need a 64 bit int for this, but you do need something
which is bigger than 32 bits.
--
Richard Jones
Red Hat
next prev parent reply other threads:[~2008-06-24 15:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 13:03 Jeremy Yallop
2008-06-24 14:32 ` [Caml-list] " Nicolas Pouillard
2008-06-24 14:30 ` Jeremy Yallop
2008-06-24 15:16 ` Richard Jones [this message]
2008-06-24 15:43 ` Hezekiah M. Carty
2008-06-24 15:54 ` Nicolas Pouillard
2008-06-24 16:04 ` Hezekiah M. Carty
2008-06-24 16:59 ` Yaron Minsky
2008-06-25 8:41 ` Richard Jones
2008-06-25 9:17 ` Christophe TROESTLER
2008-06-24 15:37 ` Nicolas Pouillard
2008-06-24 15:43 ` Andrej Bauer
2008-06-25 11:53 ` Jeremy Yallop
2008-06-25 12:16 ` Nicolas Pouillard
2008-06-24 16:07 ` Pietro Abate
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=20080624151626.GA8424@annexia.org \
--to=rich@annexia.org \
--cc=caml-list@inria.fr \
--cc=jeremy.yallop@ed.ac.uk \
--cc=nicolas.pouillard@gmail.com \
/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