Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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")

--
Francois

-------------------
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