Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: tmp123 <tmp123@menta.net>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Which camlp variant?
Date: Thu, 08 Nov 2007 01:24:27 +0100	[thread overview]
Message-ID: <1194480274-sup-1600@ausone.local> (raw)
In-Reply-To: <47320337.3030102@menta.net>

Excerpts from tmp123's message of Wed Nov 07 19:25:59 +0100 2007:
> Hello,
> 
> The module "pa_log" proposed by Mr. Conway seems very near to the 
> objective of my previuos post.
> 
> The objective  now is expand a line like: DEBUG 3 "%d\n" 14
> to: if debug.val then logint 3 ( fun () -> Printf.printf "%d\" 14  ) 
> else ();
> 
> However, it is necessary to migrate the module to new camlpx .
> 
> Please, could someone give any advice about the current options: camlp4 
> or camlp5? PreCast? Functorial?

I would recommend camlp4+PreCast because it's easier.

However camlp4 already have a builtin module very similar (called Camlp4DebugParser).

Here is a brief introduction...

(*
 * No debugging code at all:
 *   $ camlp4o -parser Camlp4DebugParser debug_extension.ml
 *   true
 * Debugging code for lexing:
 *   $ STATIC_CAMLP4_DEBUG='lexing' camlp4o -parser Camlp4DebugParser debug_extension.ml
 *  let () =
 *    if Camlp4.Debug.mode "lexing"
 *    then Debug.printf "lexing" "TOKEN: Int %d" (2 * 21)
 *    else ()
 *  in true
 *
 * Debugging code for lexing and parsing:
 *   $ STATIC_CAMLP4_DEBUG='lexing:parsing' camlp4o -parser Camlp4DebugParser debug_extension.ml
 *   let () =
 *     if Camlp4.Debug.mode "lexing"
 *     then Debug.printf "lexing" "TOKEN: Int %d" (2 * 21)
 *     else () in
 *   let () =
 *     if Camlp4.Debug.mode "parsing"
 *     then Debug.printf "parsing" "RULE: ..."
 *     else ()
 *   in true
 *
 * Debugging code for any section:
 *  $ STATIC_CAMLP4_DEBUG='*' camlp4o -parser Camlp4DebugParser debug_extension.ml
 *  ... same output as above ...
 *
 * When you program is compiled you can use the CAMLP4_DEBUG variable to
 * activate some debugging sections.
 *
 * CAMLP4_DEBUG_FILE manage where messages goes (default is stderr).
 *)

camlp4_debug lexing  "TOKEN: Int %d" (2 * 21) in
camlp4_debug parsing "RULE: ..." in
true
-- 
Nicolas Pouillard aka Ertai


  parent reply	other threads:[~2007-11-08  0:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 18:25 tmp123
2007-11-07 18:20 ` [Caml-list] " Martin Jambon
2007-11-08  0:24 ` Nicolas Pouillard [this message]
2007-11-08  0:48 ` Christopher L Conway
     [not found]   ` <4a051d930711071716n7c88dde9t7dfe4c190ea3a90d@mail.gmail.com>
2007-11-09 11:34     ` tmp123

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=1194480274-sup-1600@ausone.local \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=tmp123@menta.net \
    /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