From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA21815; Sun, 13 Jan 2002 02:29:15 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA21862 for ; Sun, 13 Jan 2002 02:29:14 +0100 (MET) Received: from c007.snv.cp.net (c007-h011.c007.snv.cp.net [209.228.33.217]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id g0D1TDP24487 for ; Sun, 13 Jan 2002 02:29:13 +0100 (MET) Received: (cpmta 15715 invoked from network); 12 Jan 2002 17:29:07 -0800 Received: from 65.187.194.217 (HELO vaiobambino) by smtp.directvinternet.com (209.228.33.217) with SMTP; 12 Jan 2002 17:29:07 -0800 X-Sent: 13 Jan 2002 01:29:07 GMT From: "Jeff Henrikson" To: Subject: [Caml-list] RE: camlp4: generating keyword on the fly Date: Sat, 12 Jan 2002 20:44:56 -0500 Message-ID: <005301c19bd3$e76efd60$0b01a8c0@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Aha. Never mind. I figured it out. Use $keyword$ around it. Sorry. Jeff Henrikson > -----Original Message----- > From: Jeff Henrikson [mailto:jehenrik@yahoo.com] > Sent: Saturday, January 12, 2002 8:29 PM > To: caml-list@inria.fr > Subject: camlp4: generating keyword on the fly > > > I want to be able to cook up keywords on the fly using camlp4, and it seems like I should be able to do it. But this is > as far as I get. This function compiles: > > > let make_one_item_entry entrysym (keyword : string) = > let tmp = (Grammar.Entry.create Pcaml.gram entrysym) in > EXTEND > tmp: [ [ "birthday" ] ] > ; > END; > tmp;; > > Grammar.Entry.print (make_one_item_entry "happy" "birthday");; > > # [ LEFTA > [ "birthday" ] ] > - : unit = () > > > But this one does not: > > > let make_one_item_entry entrysym (keyword : string) = > let tmp = (Grammar.Entry.create Pcaml.gram entrysym) in > EXTEND > tmp: [ [ keyword ] ] > ; > END; > tmp;; > > Grammar.Entry.print (make_one_item_entry "happy" "birthday");; > > > Note that this looks right but isn't: > > > let make_one_item_entry entrysym (keyword : string) = > let tmp = (Grammar.Entry.create Pcaml.gram entrysym) in > let tmp2 = (Grammar.Entry.create Pcaml.gram keyword) in > EXTEND > tmp: [ [ tmp2 ] ] > ; > END; > tmp;; > > Grammar.Entry.print (make_one_item_entry "happy" "birthday");; > > # [ LEFTA > [ birthday ] ] > - : unit = () > > > (The quotes are missing) I'm new at camlp4, so I don't know if my jargon for explaining this is right, but: > > I can get an empty entry with Grammar.Entry.create, but the only way to extend it seems to be with EXTEND which so far > as I can see only takes string constants. Does this make sense? > > > Jeff Henrikson > > ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr