Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4: From AST to shortcuts
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@i...>
Subject: Re: [Caml-list] camlp4: From AST to shortcuts
Excerpts from joelr1's message of Wed Oct 10 15:00:54 +0200 2007:
> 
> On Oct 10, 2007, at 1:36 PM, Nicolas Pouillard wrote:
> 
> > With the pretty printer.
> > ...
> > let _loc = ghost;;
> > Format.eprintf "<:ctyp< %a >>@." pp#ctyp (Ast.TyId (_loc, Ast.IdLid  
> > (_loc, "int")));;
> 
> That doesn't quite work since I have to know to use a ctyp. I was  
> wondering if there was a way to figure out the shortcut without  
> knowing about ctyp beforehand.
> 
> Then again, I looked at Camlp4/Camlp4Ast.partial.ml and, conveniently  
> enough, TyId is located under ctyp whereas CrIn (class initializer;  
> what's the "r" in Cr?) is under class_str_item.
> 
> Can it be THAT simple?

Of    course!   The   convention   for   quotations   given   by   camlp4   is
<:type_name<...>>,  <:expr<...>>  is  for  Ast.expr, <:class_str_item<...>> is
for Ast.class_str_item...

-- 
Nicolas Pouillard aka Ertai