Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 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 Archives:
Bug reports: FAQ:
Beginner's list: