caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Andrea Giugliano <ag400@leicester.ac.uk>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Parse error with camlp4 while sources compile
Date: Wed, 13 Aug 2014 18:28:42 +0200	[thread overview]
Message-ID: <CAPFanBGguypqaMg7E0HzpoEBd1Qt9Uc+Tf+HVvM301-u-EnJ5w@mail.gmail.com> (raw)
In-Reply-To: <53EB8484.5070907@le.ac.uk>

Camlp4 uses a different parser technology than the OCaml compiler, so
it warns about syntax errors in a different way. It happens sometimes
to be wrong, but it is most of the time right, and gives relatively
good error message. (In case there is a discrepancy between what the
compiler accepts and Camlp4 accept, I recommend that you write code
accepted by both.)

module A (AO : a) : sig
> Parse error: [module_type] expected after ":" (in [module_declaration])

Module type names, as module names, must start with an uppercase
letter. Rename the signature into A or ASig, and you will be fine (for
this particular error).

On Wed, Aug 13, 2014 at 5:30 PM, Andrea Giugliano <ag400@leicester.ac.uk> wrote:
> 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
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2014-08-13 16:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 15:30 Andrea Giugliano
2014-08-13 16:28 ` Gabriel Scherer [this message]
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=CAPFanBGguypqaMg7E0HzpoEBd1Qt9Uc+Tf+HVvM301-u-EnJ5w@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=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).