From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 6B6437ED7A for ; Mon, 27 Aug 2012 13:45:38 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.216.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.216.54 as permitted sender) identity=mailfrom; client-ip=209.85.216.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qa0-f54.google.com) identity=helo; client-ip=209.85.216.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-qa0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An8DAKBdO1DRVdg2jWdsb2JhbABFum4IIgEBAQEJCQsJEgYjgiABAQEEEgIkCAEbHAEBAwwGBQsNCRYPCQMCAQIBEREBBQEcBg0BBwEBHodbAQMMm1QJA4wignOEewoZJw1XiHEBBQyKfIcRA5VVgRSNIz6EHw X-IronPort-AV: E=Sophos;i="4.80,320,1344204000"; d="scan'208";a="153920302" Received: from mail-qa0-f54.google.com ([209.85.216.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Aug 2012 13:45:37 +0200 Received: by qatn12 with SMTP id n12so2137981qat.6 for ; Mon, 27 Aug 2012 04:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=IqZ6ISs3gfEx7JEQn75Emf7/uzunMPdjCDiTLDihYn4=; b=Vq00niExEqxe6nswZWoiQZQeM8zduEFe73ggzeQOnfaSfTxd3Z3P5rIoJMZcgS4g/g trT4dLOmv9PohLKjWRYkxmPXwJeRPQ7rTZDZSmNz50T9pu3rIiWQrvlWQ3oB4KQ0junp LRoZFaew6bzAkgrEAExtY8I7I4zNKGT4+kcH1H9n6GgsWVjd7NipUxiOExEDIlOSUAKj quEkWOFAajcBcMmNVxeSgDuKVDPcCWrdhW3pjc74QCPRBkNUVE6T6PQ6Mak+RGkxOJdh Z2EbKaEdVYtf1Rt/LtbMgQFViBlGDJqXb6+S7cTA6ycQzDM6z1wKdewnpgZBM0JMQArP QvBg== Received: by 10.229.137.146 with SMTP id w18mr1404237qct.12.1346067936287; Mon, 27 Aug 2012 04:45:36 -0700 (PDT) Received: from Hongbos-MacBook-Air.local ([66.250.143.158]) by mx.google.com with ESMTPS id w4sm1072379qaa.9.2012.08.27.04.45.35 (version=SSLv3 cipher=OTHER); Mon, 27 Aug 2012 04:45:35 -0700 (PDT) Message-ID: <503B5DDE.1070705@gmail.com> Date: Mon, 27 Aug 2012 07:45:34 -0400 From: Hongbo Zhang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Alain Frisch CC: Caml List References: <503A9815.7000103@gmail.com> <503B3818.1050503@frisch.fr> In-Reply-To: <503B3818.1050503@frisch.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Is there a printer for ocaml's parsetree 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