caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andrea Giugliano <ag400@leicester.ac.uk>
To: caml-list@inria.fr
Subject: [Caml-list] Parse error with camlp4 while sources compile
Date: Wed, 13 Aug 2014 16:30:12 +0100	[thread overview]
Message-ID: <53EB8484.5070907@le.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

Dear list,

I am trying to test my ocaml application using a test coverage tool 
called bisect (http://bisect.x9c.fr/index.html).
This tool uses camlp4 to instrument the source code, i.e. adding the 
check points to say that the source code has been explored by the tests.
When I try to instrument my application, I get the following error from 
camlp4:

Parse error: [module_type] expected after ":" (in [module_declaration])
Error while running external preprocessor

Is it possible that camlp4 does not support the functor feature of OCaml?
Has anyone had this error before?

I googled for the error string and similar errors, but I could not find 
anything promising.
I also searched the archives of this mailing list and the wg-camlp4 
mailing list, but nothing similar was present.
The following source files raise the same error (they successfully 
compile though!):

(* test.mli -------------- *)

module type a = sig
     type t
end

module A (AO : a) : sig
     val f : AO.t -> bool
end

(* test.ml --------------- *)

module type a = sig
     type t
end

module A (AO : a) = struct
     let f ( x : AO.t) = true
end

let _ = print_endline "test"
(* ------------------------- *)

I attached them and the Makefile that I am using to create the executable.
If you want to reproduce the error, you need to have installed Ocaml 
4.01, ocamlfind and the last version of bisect
(the most comfortable installation is through OPAM:
     opam install ocamlfind
     opam install bisect).
Thanks for your attention,

Andrea Giugliano

[-- Attachment #2: Makefile --]
[-- Type: text/plain, Size: 415 bytes --]

OCAMLFIND=ocamlfind
CAMLOPT=$(shell command -v ocamlopt.opt || command -v ocamlopt || echo missing_ocamlopt)
WARNINGS=-w -26-8-23
COMPFLAGS=$(WARNINGS) 
BISECTDIR=$(shell $(OCAMLFIND) -query bisect)

test.native:
	$(CAMLOPT) -I $(BISECTDIR) -pp 'camlp4o str.cma $(BISECTDIR)/bisect_pp.cmo' $(COMPFLAGS) -I $(BISECTDIR) bisect.cmxa -o my test.mli test.ml

justNative:
	$(CAMLOPT) $(COMPFLAGS) -o my test.mli test.ml

[-- Attachment #3: test.ml --]
[-- Type: text/x-ocaml, Size: 123 bytes --]

module type a = sig
    type t
end

module A (AO : a) = struct
    let f ( x : AO.t) = true
end

let _ = print_endline "!"

[-- Attachment #4: test.mli --]
[-- Type: text/x-ocaml, Size: 89 bytes --]

module type a = sig
    type t
end

module A (AO : a) : sig
    val f : AO.t -> bool
end

             reply	other threads:[~2014-08-13 15:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 15:30 Andrea Giugliano [this message]
2014-08-13 16:28 ` Gabriel Scherer
2014-08-13 18:36   ` Drup
2014-08-13 18:47     ` Gabriel Scherer
2014-08-13 22:43   ` Andrea Giugliano

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=53EB8484.5070907@le.ac.uk \
    --to=ag400@leicester.ac.uk \
    --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).