caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hongbo Zhang <bobzhang1988@gmail.com>
To: Alain Frisch <alain@frisch.fr>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Is there a printer for ocaml's parsetree
Date: Mon, 27 Aug 2012 07:45:34 -0400	[thread overview]
Message-ID: <503B5DDE.1070705@gmail.com> (raw)
In-Reply-To: <503B3818.1050503@frisch.fr>

On 8/27/12 5:04 AM, Alain Frisch wrote:
> On 08/26/2012 11:41 PM, Hongbo Zhang wrote:
>> Hi List,
>>     Is there any printer for ocaml's parsetree, I mean when you print
>> the parsetree, the textual output can be fed to the ocaml's compiler 
>> again.
>>     I took a look at the ocaml's source tree, the built-in printer for
>> ocaml's parsetree seems to be only for debugging purpose.
>
> There is a printer in tools/pprintast.ml.  It would be useful to 
> integrate it to the ocaml compilers, with an option to tell them to 
> dump the (preprocessed) parsetree in source form.
>
I found this was only used in tools/cmt2annot.ml. It would be useful to 
have it installed. The output of -dparsetree is not that readable, more 
important, it would be great if the output could be compiled again.

It's non-noncessarily complex that camlp4 maintains 4 printers (one for 
original, revised, and 2 for toplevel).

Just filed a feature request.
Thanks!
>> Alain, when you do Ast-Rewriter, how do you visualize the output if you
>> don't have a printer for ocaml's parsetree?
>
> Currently, I use -dparsetree when I need to debug some ast rewriter 
> (-ppx).
>
>
> -- Alain


  reply	other threads:[~2012-08-27 11:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-26 21:41 Hongbo Zhang
2012-08-27  9:04 ` Alain Frisch
2012-08-27 11:45   ` Hongbo Zhang [this message]
2012-10-17 16:20   ` Alain Frisch
2012-10-18  0:31     ` bob zhang

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=503B5DDE.1070705@gmail.com \
    --to=bobzhang1988@gmail.com \
    --cc=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    /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).