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 EAAB6BBFC for ; Tue, 21 Jun 2005 17:18:26 +0200 (CEST) Received: from mail.tcs.inf.tu-dresden.de (tcs01.inf.tu-dresden.de [141.76.75.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5LFIQma017480 for ; Tue, 21 Jun 2005 17:18:26 +0200 Received: from conversion-daemon.mail.tcs.inf.tu-dresden.de by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) id <0IIF00H01PURJO00@mail.tcs.inf.tu-dresden.de> (original mail from tews@tcs.inf.tu-dresden.de) for caml-list@yquem.inria.fr; Tue, 21 Jun 2005 17:18:26 +0200 (MEST) Received: from ithif59.inf.tu-dresden.de (ithif59.inf.tu-dresden.de [141.76.75.59]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTPS id <0IIF00FBGX6Q5F00@mail.tcs.inf.tu-dresden.de> for caml-list@yquem.inria.fr; Tue, 21 Jun 2005 17:18:26 +0200 (MEST) Received: from tews by ithif59.inf.tu-dresden.de with local (Exim 4.50) id 1DkkWA-0006Rr-9y for caml-list@yquem.inria.fr; Tue, 21 Jun 2005 17:18:26 +0200 Date: Tue, 21 Jun 2005 17:18:26 +0200 From: Hendrik Tews Subject: Re: [Caml-list] OCaml IDE (Camlp4 for code formatting) In-reply-to: To: caml-list@yquem.inria.fr Message-id: MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-Miltered: at concorde with ID 42B82FC2.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 caml-list:01 ocaml:01 hendrik:01 semantically:01 rewrites:01 cmo:01 rewriting:01 parser:01 ocaml:01 grammar:01 2005,:98 ...: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: "Nathaniel J. Gaylinn" writes: 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... Not sure if you got me right: The two phrases "let _ = 5" and "5" are semantically equivalent and probably compiled to the same code. However, they have a different representation as a camlp4 ast. Still the question remains, why camlp4 rewrites one into the other. 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. If you pretty print an camlp4 ast similar to pr_o.cmo then you will always change the input (ie. rewriting "(1,2)" into "1,2" or vice versa). I don't think it makes sense to track the input to recover the information that is not present in camlp4's ast, because you would have to parse the input. If you want to output all comments and print "(1,2)" as "(1,2)" and "1,2" as "1,2" then you need a new parser for ocaml. Camlp4 won't help much in this case. It is probably easier to adjust the yacc grammar from the ocaml sources. Bye, Hendrik