Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] type problem with camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-07 (22:36)
From: Pietro Abate <Pietro.Abate@a...>
Subject: Re: [Caml-list] type problem with camlp4
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.

	[[ n = STRING ->
		let node = magic_function ( parse_string n ) in
		let id = gen_id() in

who can I do that ? what is the magic function ?

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: