caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: joelr1 <joelr1@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Pretty-printing the OCaml AST from the toplevel
Date: Mon, 08 Oct 2007 14:49:52 +0200	[thread overview]
Message-ID: <1191847701-sup-5705@ausone.inria.fr> (raw)
In-Reply-To: <939CC7FB-3889-49BE-90BC-77491658409C@gmail.com>

Excerpts from joelr1's message of Mon Oct 08 12:57:56 +0200 2007:
> Are there any examples of pretty-printing the OCaml AST from the  
> toplevel?

$ rlwrap ocaml camlp4of.cma
open Camlp4.PreCast;;
module PP = Camlp4.Printers.OCaml.Make(Syntax);;
let pp = new PP.printer ();;
let ghost = Loc.ghost;;
module PP = Camlp4.Printers.OCaml.Make(Syntax);;
Format.eprintf "%a@." pp#expr <:expr@ghost< 3 + 4 >>;;

> I'm looking to use this during interactive debugging.
> 
> I see the following example in the camlp4 changes doc
> 
> camlp4 -parser OCaml -printer OCamlr foo.ml
> 
> but I'm still browsing through Camlp4.ml to figure out what that does  
> exactly.

Camlp4.ml  is  a  generated file. It's perhaps not the best way to read camlp4
sources.

-- 
Nicolas Pouillard aka Ertai


      reply	other threads:[~2007-10-08 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 10:57 Joel Reymont
2007-10-08 12:49 ` Nicolas Pouillard [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=1191847701-sup-5705@ausone.inria.fr \
    --to=nicolas.pouillard@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.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).