From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA09528; Fri, 30 May 2003 22:13:29 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA09414 for ; Fri, 30 May 2003 22:13:27 +0200 (MET DST) Received: from mallaury.noc.nerim.net (smtp-105-friday.noc.nerim.net [62.4.17.105]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4UKDRH28781 for ; Fri, 30 May 2003 22:13:27 +0200 (MET DST) Received: from hector.lesours (lesours.starynkevitch.net [80.65.224.217]) by mallaury.noc.nerim.net (Postfix) with ESMTP id 908BC62E19; Fri, 30 May 2003 22:13:24 +0200 (CEST) Received: from basile by hector.lesours with local (Exim 3.36 #1 (Debian)) id 19LqFi-0005HT-00; Fri, 30 May 2003 22:13:26 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <16087.47974.781130.674211@hector.lesours> Date: Fri, 30 May 2003 22:13:26 +0200 To: Matt Gushee Cc: caml-list@pauillac.inria.fr Subject: [Caml-list] Good examples for a Camlp4 beginner? In-Reply-To: <20030530185206.GC2087@swordfish> References: <20030530185206.GC2087@swordfish> X-Mailer: VM 7.16 under Emacs 21.3.2 From: Basile STARYNKEVITCH X-Spam: no; 0.00; basile:01 caml-list:01 camlp:01 gushee:01 mgushee:01 havenrock:01 all--:01 real-world:01 non-trivial:01 poesia:01 cvsweb:01 poesiasoft:01 mli:01 foo:01 flags:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "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 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: basilestarynkevitchnet aliases: basiletunesorg = bstarynknerimnet 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