Dear camlp4 gurus,
I am looking to extend the ocaml syntax to add some keyword to module signatures (in a similar way the type-conv module does for type definition). However I am stuck with a very basic example. Can anyone tell me what's wrong here ? It seems that my extension clashes with 'module_type t ::= mt with wc' in http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree#Module_types but I still have the same problem if I change the 'with' keyword to 'where'.
Cheers,
Thomas
=== foo.ml ===
open Camlp4
open PreCast
open Ast
open Syntax
EXTEND Gram
GLOBAL: sig_item;
sig_item: [[
"module"; "type"; i = a_UIDENT; "="; mt = module_type; "with"; id = LIDENT ->
<:sig_item< module type $uid:i ^ "_" ^ id$ = $mt$; >>
]];
END
===
=== test.ml ===
module type S = sig
val x : unit -> unit
end with foo
===
=== compilation
$ ocamlfind ocamlc -package camlp4 -c -pp "camlp4orf" foo.ml
$ camlp4o foo.cmo test.ml
File "foo.ml", line 3, characters 4-8:
Parse error: [with_constr] expected after "with" (in [module_type])
===