From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 8E657BC69 for ; Mon, 20 Aug 2007 15:24:54 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7KDOr7O003919 for ; Mon, 20 Aug 2007 15:24:53 +0200 Received: by wa-out-1112.google.com with SMTP id m28so702418wag for ; Mon, 20 Aug 2007 06:24:52 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PpNHf4zyMgitl+Ul7epT5a4XLJMwfpvzD4+4m6h9MuU8Mt0XnCg9r77cyZhFm9/qraitb7iHEVMPCDagbMP5VUTJ4ozL79wDcuy400N1aWmiUCNL0ywJRdFIylQ53G51qE7F9Jud7u/XCzv1/E+Sr0UdiKXwH4PkZNYmYzajzmg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=K0Gx44RQFFgX5qR54dLUkFfvJuNLi/kqvtNovUyi1rZ5pCNbkI4LWduxzWTXJnKxVeZcLsGJX8yXwfWYT+ftzMrYCHcoYeVxqGRoYbHmGiJyIuq/gKmAcFfdqmg5MtE570XgF6XTxx1Dkn8D1Ueis21pGp4vFANsYJWJrITJ9Hs= Received: by 10.114.174.2 with SMTP id w2mr1074632wae.1187616290628; Mon, 20 Aug 2007 06:24:50 -0700 (PDT) Received: by 10.64.148.3 with HTTP; Mon, 20 Aug 2007 06:24:50 -0700 (PDT) Message-ID: <6f9f8f4a0708200624x1b09dc40u2d5fa76b4a70faf7@mail.gmail.com> Date: Mon, 20 Aug 2007 15:24:50 +0200 From: "Loup Vaillant" To: "Caml mailing list" Subject: Re: [Caml-list] How can I generate an AST? In-Reply-To: <20070820111350.GA22843@yquem.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6f9f8f4a0708191039o2119f94bm10959175cc887eef@mail.gmail.com> <20070819181634.GA797@yquem.inria.fr> <6f9f8f4a0708200122k710b2f3dnd723a7244140575e@mail.gmail.com> <20070820111350.GA22843@yquem.inria.fr> X-j-chkmail-Score: MSGID : 46C99625.003 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46C99625.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; rauglaudre:01 rauglaudre:01 0200,:01 camlp:01 camlp:01 ocaml:01 syntax:01 ocaml:01 parser:01 syntax:01 parser:01 mli:01 compiler:01 utils:01 impl:01 2007/8/20, Daniel de Rauglaudre : > On Mon, Aug 20, 2007 at 10:22:17AM +0200, Loup Vaillant wrote: > > > This may be a better approach. However, I am not eager to use camlp*, > > for it will introduce a additional dependency. I may choose this > > however, if the camlp* AST is simpler than the Ocaml AST. Where can I > > find it? > > Solution using camlp5: > [...] > But, well, you need to know camlp5, understand the quotation system, > perhaps the revised syntax too, in one word, read the doc, and I can > understand that if you did not use camlp5 before, it is some work... Indeed. I didn't work with camlp* before, so the learning curve may be a problem, I don't know. > Other solution not using camlp*: > > Read the ocaml sources, file "parsing/parser.mly" to understand how > the ocaml syntax tree works. Program your parser to generate this > syntax tree. I have already read "parsing/parstree.mli", so I assume half the work is done! (well, I hope so, for I don't know .mly files...) > Once done, to give your syntax tree directly to the > ocaml compiler, output: > > 1/ the magic number you can find in ocaml sources at utils/config.ml > - ast_impl_magic_number for an implementation > ast_intf_magic_number for an interface > 2/ your input file name > 3/ your syntax tree in binary with "output_value" That, is what I need. Thank you. I'll notify the list once I managed to produce some output. I have still one problem, though : how should I access this code? It is not part of the standard library, so I can't just "open Config;;". I can't hard-copy this code, either, that is too ugly. Maybe there is a way to install a "development package" of Ocaml so I can link it? Thanks, Loup