From: Thomas Gazagnaire <ocaml@gazagnaire.com>
To: caml-list@inria.fr
Subject: another camlp4 question
Date: Thu, 11 Feb 2010 18:55:46 +0000 [thread overview]
Message-ID: <9722eaea1002111055q7f571aeu1797760f58ad4dd5@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
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_typesbut
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])
===
[-- Attachment #2: Type: text/html, Size: 1535 bytes --]
next reply other threads:[~2010-02-11 18:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 18:55 Thomas Gazagnaire [this message]
2010-02-12 12:16 ` Thomas Gazagnaire
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9722eaea1002111055q7f571aeu1797760f58ad4dd5@mail.gmail.com \
--to=ocaml@gazagnaire.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).