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
[Caml-list] Good examples for a Camlp4 beginner?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: [Caml-list] Good examples for a Camlp4 beginner?
>>>>> "Matt" == Matt Gushee <> writes:

    Matt> Hello, all-- Over the past couple of weeks I have been
    Matt> learning about the various OCaml parsing and lexing tools,
    Matt> with an emphasis on Camlp4. It's fascinating, and I've
    Matt> learned a lot, but I am still having trouble grasping how
    Matt> the different components fit together. I think what I need
    Matt> now is to look at some examples of working, real-world code
    Matt> that use Camlp4 ... something non-trivial, but not
    Matt> enormously complex. Can anyone suggest a good place to
    Matt> start?

Yes, you might look into the tracing facilities of Poesia monitor;

get the following files (under CVS) from


In a few words, the preprocessing file transform
expressions like
   trace FOO "x=%d y=%d" x y tracend
    if then
        Trace.tracer Trace.FOO  [filename]  [lineno]  [colno]
          (Printf.sprintf "x=%d y=%d" x y

where [filename] is actually the string of the source filename, eg
"", [lineno] is the line number, eg 43, etc.

Even if I coded some camlp4 stuff, I definitely do not claim to be a
camlp4 expert. In particular, I never coded any pretty printer.

Of course you could have a look into the Coq proof system, which
(IIRC) initated the development of camlp4 and which is probably the
major camlp4 user.


email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: