Excerpts from SerP's message of Thu Sep 11 14:15:59 +0200 2008: > On Thu, 2008-09-11 at 13:00 +0100, Jeremy Yallop wrote: > > Quoting ?????? ??????? : > > > Exitst any way to do such things? > > > > > > ------ > > > let t = <:ctyp> in > > > <:str_item> > > > > I think that you're looking for this: > > > > let t = <:expr< <:ctyp> >> in > > <:str_item> > > > > although I'm curious as to why. > > > > Jeremy. > > > > The problem what t variable result of parsing > > EXTEND Gram > str_item: > [ > [ "mtype" ; n = a_LIDENT ; "=" ; t = ctype -> > <:expr< > let f = <:expr<$t$>> > >> > ] > END > > And result now is: > > let f = t > > But i need to: > > let f = Ast.TyId (_loc, Ast.IdLid (_loc, "int")) You the syntactic meta lifting (as in <:expr< <:ctyp< int >> >>) is not sufficient, you need to call the function that do this lifting. #load "camlp4of.cma";; open Camlp4.PreCast;; module M = Ast.Meta.Make(Ast.Meta.MetaGhostLoc);; let ghost = Loc.ghost;; let t = <:ctyp@ghost< int >>;; M.Expr.meta_ctyp ghost t;; Best regards, PS: Tolevel output :) - : Camlp4.PreCast.Ast.expr = Camlp4.PreCast.Ast.ExApp (, Camlp4.PreCast.Ast.ExApp (, Camlp4.PreCast.Ast.ExId (, Camlp4.PreCast.Ast.IdAcc (, Camlp4.PreCast.Ast.IdUid (, "Ast"), Camlp4.PreCast.Ast.IdUid (, "TyId"))), Camlp4.PreCast.Ast.ExId (, Camlp4.PreCast.Ast.IdAcc (, Camlp4.PreCast.Ast.IdUid (, "Loc"), Camlp4.PreCast.Ast.IdLid (, "ghost")))), Camlp4.PreCast.Ast.ExApp (, Camlp4.PreCast.Ast.ExApp (, Camlp4.PreCast.Ast.ExId (, Camlp4.PreCast.Ast.IdAcc (, Camlp4.PreCast.Ast.IdUid (, "Ast"), Camlp4.PreCast.Ast.IdUid (, "IdLid"))), Camlp4.PreCast.Ast.ExId (, Camlp4.PreCast.Ast.IdAcc (, Camlp4.PreCast.Ast.IdUid (, "Loc"), Camlp4.PreCast.Ast.IdLid (, "ghost")))), Camlp4.PreCast.Ast.ExStr (, "int"))) -- Nicolas Pouillard aka Ertai