caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Parse error with camlp4 while sources compile
@ 2014-08-13 15:30 Andrea Giugliano
  2014-08-13 16:28 ` Gabriel Scherer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Giugliano @ 2014-08-13 15:30 UTC (permalink / raw)
  To: caml-list

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-13 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-13 15:30 [Caml-list] Parse error with camlp4 while sources compile Andrea Giugliano
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

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).