caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: Matt Gushee <mgushee@havenrock.com>
Cc: caml-list@pauillac.inria.fr
Subject: [Caml-list] Good examples for a Camlp4 beginner?
Date: Fri, 30 May 2003 22:13:26 +0200	[thread overview]
Message-ID: <16087.47974.781130.674211@hector.lesours> (raw)
In-Reply-To: <20030530185206.GC2087@swordfish>

>>>>> "Matt" == Matt Gushee <mgushee@havenrock.com> 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
http://www2.poesia-filter.org:8000/cgi-bin/cvsweb.cgi/PoesiaSoft/PoesiaMonIcap/

README.trace
pa_trace.ml

trace.ml
trace.mli

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

where [filename] is actually the string of the source filename, eg
"foobar.ml", [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.

Regards.
-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      parent reply	other threads:[~2003-05-30 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-30 18:52 Matt Gushee
2003-05-30 19:13 ` Alexander V. Voinov
2003-05-30 19:27   ` Matt Gushee
2003-05-30 20:13 ` Basile STARYNKEVITCH [this message]

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=16087.47974.781130.674211@hector.lesours \
    --to=basile@starynkevitch.net \
    --cc=caml-list@pauillac.inria.fr \
    --cc=mgushee@havenrock.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;
as well as URLs for NNTP newsgroup(s).