Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

(v3.7.0) OCaml: camlp4o

LCD 47 edited this page Oct 6, 2015 · 1 revision

Maintainer: Török Edwin edwintorok@gmail.com

ocamlc is a compiler for Caml. See the project's page for details.

Checker options

The more reliable way to check for a single .ml file is to use ocamlc. You can do that setting this in your .vimrc:

let g:syntastic_ocaml_use_ocamlc = 1

It's possible to use ocamlc in conjunction with Jane Street's core. In order to do that, you have to specify something like this in your .vimrc:

let g:syntastic_ocaml_use_janestreet_core = 1
let g:syntastic_ocaml_janestreet_core_dir = '/path/to/core/dir'

Where path is the path to your core installation (usually a collection of .cmx and .cmxa files).

By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files, ocamllex is used to check .mll files and menhir is used to check .mly files. The output is all redirected to /dev/null, nothing is written to the disk.

If your source code needs camlp4r then you can define this in your .vimrc:

let g:syntastic_ocaml_camlp4r = 1

If you used some syntax extensions, or you want to also typecheck the source code, then you can define this:

let g:syntastic_ocaml_use_ocamlbuild = 1

This will run ocamlbuild <name>.inferred.mli, so it will write to your _build directory (and possibly rebuild your myocamlbuild.ml plugin), only enable this if you are ok with that.

If you are using syntax extensions / external libraries and have a properly set up _tags (and myocamlbuild.ml file) then it should just work to enable this flag and get syntax / type checks through syntastic.

For best results your current directory should be the project root (same situation if you want useful output from :make).

Notes

  • You might consider using the checkers packaged with Merlin instead of this one. They provide type errors and let you use packages outside core.
  • This checker doesn't call the makeprgBuild() function, and thus it ignores the usual g:syntastic_ocaml_camlp4o_<option> variables.
Clone this wiki locally