From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id ACE60BBFB for ; Tue, 21 Jun 2005 15:47:36 +0200 (CEST) Received: from salt.cs.brown.edu (salt.cs.brown.edu [128.148.32.122]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5LDlaPY007354 for ; Tue, 21 Jun 2005 15:47:36 +0200 Received: from localhost (localhost [127.0.0.1]) by salt.cs.brown.edu (Postfix) with ESMTP id D3ADA3864A2; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Received: from salt.cs.brown.edu ([127.0.0.1]) by localhost (salt [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06981-04; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Received: from null.cs.brown.edu (null.cs.brown.edu [128.148.38.190]) by salt.cs.brown.edu (Postfix) with ESMTP id A70C13864BF; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Received: from point.cs.brown.edu (point [128.148.33.31]) by null.cs.brown.edu (Postfix) with ESMTP id 68B46148011; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Received: by point.cs.brown.edu (Postfix, from userid 30102) id 4E1B27DE5; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by point.cs.brown.edu (Postfix) with ESMTP id 411744530E; Tue, 21 Jun 2005 09:47:35 -0400 (EDT) Date: Tue, 21 Jun 2005 09:47:35 -0400 (EDT) From: "Nathaniel J. Gaylinn" X-X-Sender: ngaylinn@point To: Hendrik Tews Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] OCaml IDE (Camlp4 for code formatting) In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at cs.brown.edu X-Miltered: at concorde with ID 42B81A78.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 hendrik:01 tews:01 syntax:01 compiler:01 pcaml:01 pcaml:01 mlast:01 mli:01 constructors:01 mlast:01 mli:01 tuareg:01 2005,:98 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Tue, 21 Jun 2005, Hendrik Tews wrote: > I understand why it makes this change, > > Could you explain? (Because I don't understand. "let _ = 5" and > "5" are different internally.) Heh, I didn't realize that they were handled different internally ;) I thought it was a reasonable thing to do because it is more explicit and equivalent, but if it isn't actually equivalent... > > On a similar note, is there any reference to the format in which Camlp4 > outputs its syntax tree? > > I don't think so. It is defined in the compiler sources and > probably not for the general public. However, you can define your > own camlp4 printers: Write a module that overwrites > Pcaml.print_implem and load this module into camlp4. The function > that you plug into Pcaml.print_implem has to pattern match on > camlp4's ast, which is defined in mLast.mli. You can use the > constructors from mLast.mli or the quotations from q_MLast. See > the source of pr_o or other pretty printers (like in my ocamlp4 > package). Would it be difficult to write a printer that had much direct access with the original file? That's something that I'd quite obviously need. In any way, I think I'm going to try to do more research into how Tuareg does its indentation. It's unfortunately not well documented, but it has the added benefit of being able to indent one line at a time. I'll take a look into writing a new printer, but I suspect that that will be the harder route... correct me if I'm wrong! -- Nate