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 8356CBC48 for ; Thu, 24 Mar 2005 06:29:28 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2O5TRQ8020967 for ; Thu, 24 Mar 2005 06:29:27 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA25635 for ; Thu, 24 Mar 2005 06:29:27 +0100 (MET) Received: from mail.rsise.anu.edu.au (mail.rsise.anu.edu.au [150.203.208.4]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2O5TNch016091 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 24 Mar 2005 06:29:26 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id DEB871A368 for ; Thu, 24 Mar 2005 16:29:19 +1100 (EST) Received: from mail.rsise.anu.edu.au ([150.203.208.4]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17336-02 for ; Thu, 24 Mar 2005 16:29:19 +1100 (EST) Received: from pulp.anu.edu.au (pulp.rsise.anu.edu.au [150.203.208.49]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id CE92014B76 for ; Thu, 24 Mar 2005 16:29:19 +1100 (EST) Received: by pulp.anu.edu.au (Postfix, from userid 1560) id 008F025B791; Thu, 24 Mar 2005 16:29:18 +1100 (EST) Date: Thu, 24 Mar 2005 16:29:18 +1100 From: Pietro Abate To: ocaml ml Subject: passing argument in campl4 ? Message-ID: <20050324052918.GA30200@pulp.anu.edu.au> Mail-Followup-To: Pietro Abate , ocaml ml Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Australian National University) User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mail.rsise.anu.edu.au X-Miltered: at concorde with ID 42425037.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42425033.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; anu:01 top-down:01 parser:01 translated:01 val:01 syntax:01 cmo:01 mlast:01 cmo:01 pcaml:01 grammar:01 grammar:01 mlast:01 pcaml:01 lexing:01 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: Hi all, I've this small example below that I'd like to modify to pass information top-down, from aa to bb (this is definitely possible using parser and streams). I see bb as a function but as it is translated (below below) is not entirely clear to me how I can pass a value from aa: [[ "AA"; c = bb "val" -> "aa"^c ]]; to bb arg: [[ a = INT; "BB" -> a ]]; I don't think this is directly possible (using the pseudo syntax above), but I was wonder if you have a trick to achieve something similar... p ---------------- ------------------- (*pp camlp4o -I . pa_extend.cmo q_MLast.cmo *) open Pcaml let aa = Grammar.Entry.create gram "aa" let bb = Grammar.Entry.create gram "bb" EXTEND aa: [[ "AA"; c = bb -> "aa"^c ]]; bb: [[ a = INT; "BB" -> a ]]; END ------------------dump ------------------------ (*pp camlp4o -I . pa_extend.cmo q_MLast.cmo *) open Pcaml let aa = Grammar.Entry.create gram "aa" let bb = Grammar.Entry.create gram "bb" let _ = Grammar.extend [Grammar.Entry.obj (aa : 'aa Grammar.Entry.e), None, [None, None, [[Gramext.Stoken ("", "AA"); Gramext.Snterm (Grammar.Entry.obj (bb : 'bb Grammar.Entry.e))], Gramext.action (fun (c : 'bb) _ (loc : Lexing.position * Lexing.position) -> ("aa" ^ c : 'aa))]]; Grammar.Entry.obj (bb : 'bb Grammar.Entry.e), None, [None, None, [[Gramext.Stoken ("INT", ""); Gramext.Stoken ("", "BB")], Gramext.action (fun _ (a : string) (loc : Lexing.position * Lexing.position) -> (a : 'bb))]]] -- ++ WebBlog/Diary: http://blog.rsise.anu.edu.au/?q=pietro ++ ++ "All great truths begin as blasphemies." -George Bernard Shaw ++ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html