English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] module declarations in camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-01-21 (09:01)
From: Francois Maurel <Francois.Maurel@p...>
Subject: [Caml-list] Re  : [Caml-list] module declarations in camlp4
> However, since the entry "module_binding" is not defined to be  
> GLOBAL, I can not access it here.  Does anyone have any suggestions  
> about how to get around this?  Is there any specific reason that some   
> of the grammar entries are defined locally?

For a similar problem, I used Grammar.Entry.find under a Obj.magic.

let type_declaration =
  Obj.magic (Grammar.Entry.find str_item "type_declaration")
let type_kind =
  Obj.magic (Grammar.Entry.find type_declaration "type_kind")
let type_parameters =
  Obj.magic (Grammar.Entry.find type_declaration "type_parameters")
let type_parameter =
  Obj.magic (Grammar.Entry.find type_parameters "type_parameter")

As far as I understand, the expression <str_item> is the first entry  
where module_binding appears in pa_o.ml which explains the use of:
- type_declaration in my example for type_kind or type_parameters
- type_parameters  in my example for type_parameter

So you should try

let module_binding =
  Obj.magic (Grammar.Entry.find str_item "module_binding")


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