Browse thread
Custom lexer in Camlp4
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2008-06-24 (15:55) |
From: | Nicolas Pouillard <nicolas.pouillard@g...> |
Subject: | Re: [Caml-list] Custom lexer in Camlp4 |
Excerpts from Hezekiah M. Carty's message of Tue Jun 24 17:43:52 +0200 2008: > On Tue, Jun 24, 2008 at 11:16 AM, Richard Jones <rich@annexia.org> wrote: > > On Tue, Jun 24, 2008 at 03:30:23PM +0100, Jeremy Yallop wrote: > > 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. > > I toyed around with a simple extension to the pa_float example on the > camlp4 wiki. The modified version is here: [...] > Sadly camlp4 3.10+ does not play well with the toplevel, so these are > difficult to work with interactively. I do use pa_context in several > places though, and it seems to work well. Can you elaborate on that? -- Nicolas Pouillard aka Ertai