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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 34D31BC0C for ; Wed, 24 Jan 2007 23:38:39 +0100 (CET) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0OMcc9u012256 for ; Wed, 24 Jan 2007 23:38:38 +0100 Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 9B8BD9543C; Wed, 24 Jan 2007 17:38:37 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by out1.internal (MEProxy); Wed, 24 Jan 2007 17:38:37 -0500 X-Sasl-enc: M4S8eSyokSkwLaVEmeY2gSKaD41aGTHwh9JwYl3iCO8a 1169678317 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id 4B33A13D96; Wed, 24 Jan 2007 17:38:35 -0500 (EST) Date: Wed, 24 Jan 2007 14:37:39 -0800 (PST) From: Martin Jambon X-X-Sender: martin@localhost To: Pietro Abate Cc: caml-list@yquem.inria.fr, ocaml ml Subject: Re: using camlp4 api [WAS: Re: [Caml-list] parsing problem.] In-Reply-To: <20070124215329.GA17676@pulp.rsise.anu.edu.au> Message-ID: References: <20070123235940.GA32163@pulp.rsise.anu.edu.au> <20070124215329.GA17676@pulp.rsise.anu.edu.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at discorde with ID 45B7DFEE.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 camlp:01 parsing:01 camlp:01 parser:01 grammars:01 verbose:01 2007,:98 wrote:01 parsed:01 extensible:01 grammar:01 grammar:01 caml-list:01 api:01 On Thu, 25 Jan 2007, Pietro Abate wrote: > where in the first part there is a grammar definition and in the second part > the grammar is used to parse the argument of the match statement. > > my question: Is it possible to do something similar with camlp4 ? > > In the library documentation I can see that this might be possible, but I don't > quite understand where to start. The first step should be to write a small > parser to interpret the language definition and then to generate, by using the > Grammar (extensible grammars) module, other production that extend the current > grammar to parse the rest of the file. The trick part is that I cannot write (I > think) and EXTEND statement on the fly (as it should be parsed itself), but I > have to use the quotation library directly, and this is very verbose... > > Did anybody do anything similar ? One small example ? No :-) Take pa_extend.ml and unquote the quotations? (and solve the type problems which might not be so bad) Martin -- Martin Jambon http://martin.jambon.free.fr