Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
C-like macros in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-06-27 (08:08)
From: Loup Vaillant <loup.vaillant@g...>
Subject: Re: [Caml-list] C-like macros in OCaml
2007/6/27, Jeremy Yallop <>:
> Richard Jones wrote:
> > On Tue, Jun 26, 2007 at 05:00:40PM -0500, Raj B wrote:
> >> Hi there
> >>
> >> Is there any way I can achieve the use of C-like preprocessor macros
> >> in OCaml?
> >> i.e.
> >> [...]
> >[...]
> It appears to support them.  If you have a file `' containing the
> following:
> [...]

By the way, does camlp4 handle cross modules C-like macros? If it does, how?
For instance, what if I write, in :

and then, in :
let bar = FOO;;

or else:
open foo;;
let bar = FOO;;

or even :
let bar = Foo.FOO;;

Will I get what I want?

Now, what about regular quotations? And grammar rules? How can I
specify the scope of particular grammar rule (or quotation)? For the
little I know about camlp4, once defined, the scope of a new grammar
rule is global. (Idem for quotations).

Am I right?
Any clue about the way camlp4 keep track of new grammar rules an
quotations? (Or some pointer to the documentation involved)

Loup Vaillant