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
another camlp4 question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-11 (18:55)
From: Thomas Gazagnaire <ocaml@g...>
Subject: another camlp4 question
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
I still have the same problem if I change the 'with' keyword to


=== foo.ml ===
open Camlp4
open PreCast
open Ast
open Syntax


GLOBAL: sig_item;

sig_item:  [[
    "module"; "type"; i = a_UIDENT; "="; mt = module_type; "with"; id =
        <:sig_item< module type $uid:i ^ "_" ^ id$ = $mt$; >>

=== 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])