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 XAA11338; Tue, 7 Jan 2003 23:36:50 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 XAA11288 for ; Tue, 7 Jan 2003 23:36:49 +0100 (MET) Received: from axiom.anu.edu.au (axiom.anu.edu.au [150.203.127.200]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h07Mal519505 for ; Tue, 7 Jan 2003 23:36:48 +0100 (MET) Received: from pulp.anu.edu.au (pulp.anu.edu.au [150.203.126.25]) by axiom.anu.edu.au (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id h07Mait23583 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified NO) for ; Wed, 8 Jan 2003 09:36:44 +1100 Received: from pulp.anu.edu.au (localhost [127.0.0.1]) by pulp.anu.edu.au (8.12.6/8.12.6/Debian-8) with ESMTP id h07MYtvv023462 for ; Wed, 8 Jan 2003 09:34:55 +1100 Received: (from abate@localhost) by pulp.anu.edu.au (8.12.6/8.12.6/Debian-8) id h07MYtYV023460 for caml-list@inria.fr; Wed, 8 Jan 2003 09:34:55 +1100 Date: Wed, 8 Jan 2003 09:34:55 +1100 From: Pietro Abate To: caml-list@inria.fr Subject: Re: [Caml-list] type problem with camlp4 Message-ID: <20030107223455.GA23238@anu.edu.au> Mail-Followup-To: Pietro Abate , caml-list@inria.fr References: <20030107035710.GA15791@anu.edu.au> <20030107133947.B16891@verdot.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030107133947.B16891@verdot.inria.fr> User-Agent: Mutt/1.4i X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Austrialian National University) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Jan 07, 2003 at 01:39:47PM +0100, Daniel de Rauglaudre wrote: > In the syntax tree, they cannot appear as things of type "tt" since > Camlp4 cannot know all possible defined types. At this level, your > constructor is just "syntax tree of a constructor" and the constructor > name is just a string. ok, I got the problem. The next question is: can I extract the string rappresenting a variable from a variable ? in my example I would like to generate a piece of code with a datatype (ff) that is the parsing result of the string n. for example, if n = " a + b " I would like to generate a piece of code like Add (a,b), where Add is part of the datastructure: type ff = | A1 | A2 | Add of int * int and this DS will be visible from both the program and the preprocessor. el: [[ n = STRING -> let node = magic_function ( parse_string n ) in let id = gen_id() in (<:patt<$lid:id$>>,<:expr<$node$>>) ]]; who can I do that ? what is the magic function ? tnx, p ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners