{0 Dependencies}

Stanc3 is programmed in {{:https://ocaml.org/}OCaml} and built with
{{:https://github.com/ocaml/dune}dune}.

{1:build Build Dependencies}
We rely on the following packages. Note that because of the requirements
for {!xcomp}, these versions are exactly pinned.

These are automatically installed through the [scripts/install_ocaml.sh] and
[scripts/install_build_deps.sh] scripts provided in the stanc3 repository.

- OCaml 4.14.1
- Dune 3.0+
- {{:https://v3.ocaml.org/p/core/latest/doc/index.html}Core} v0.16.1 (a standard library replacement)
- {{:http://gallium.inria.fr/~fpottier/menhir/manual.html}Menhir} 20230608 (a parser generator and parsing library)
- {{:https://github.com/ocaml-ppx/ppx_deriving}ppx_deriving} 5.2.1 (a tool for generating boilerplate code)
- {{:https://erratique.ch/software/fmt}fmt} 0.9.0 (a library for pretty-printing of formatted text)
- yojson 2.1.0 (a library for producing JSON files)


For the JavaScript interface to stanc3 we also use the following, installed
via [scripts/install_js_deps.sh]
- js_of_ocaml 5.4.0

The [stancjs] executable can be built with

[dune build src/stancjs]

{1:dev Development Dependencies}
There are several packages which are useful for development but not required for building
stanc3. These can be installed with [scripts/install_dev_deps.sh], or (alongside the above
build requirements) with [scripts/setup_dev_env.sh]. Versioning of these dependencies is less
strict, though some (like ocamlformat) are used to ensure a standard format across developers
and must use the same version.

- ocamlformat 0.26.1
- merlin
- ocaml-lsp-server
- utop
- ocp-indent
- patdiff
- odoc
- bisect_ppx

{1:xcomp Cross Compilation for Windows}
To support Windows binaries, we
use versions of OCaml and all our dependencies which are available
on {{:https://github.com/ocaml-cross/opam-cross-windows}opam-cross-windows}.
This allows us to build Windows-compatible versions {e on non-Windows machines}.

For more information on cross-compilation, see the
{{:https://dune.readthedocs.io/en/stable/cross-compilation.html}dune docs}.

To build Windows binaries, the above build requirements must have their
[opam-cross-windows] equivalents installed. This can be done by executing
[scripts/install_build_deps_windows.sh].

Then, the command

[dune build -x windows]

will build a Windows binary.
