Version franaise
Home About Download Resources Contact us
Browse thread
Camlp4. print variable value to target source.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Сергей_ Плаксин <serp@s...>
Subject: Re: [Caml-list] Camlp4. print variable value to target source.
On Thu, 2008-09-11 at 13:00 +0100, Jeremy Yallop wrote:
> Quoting ?????? ??????? <serp@stork.ru>:
> > Exitst any way to do such things?
> >
> > ------
> >   let t = <:ctyp<int>> in
> >   <:str_item<let t = ?content of t here? >>
> 
> I think that you're looking for this:
> 
>      let t = <:expr< <:ctyp<int>> >> in
>      <:str_item<let t = $t$ >>
> 
> 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"))