\chapter{The compiler front-end} \label{c:parsinglib}\cutname{parsing.html}
\label{Compiler-underscorelibs} % redirect references to compiler_libs.mld here

This chapter describes the OCaml front-end, which declares the abstract
syntax tree used by the compiler, provides a way to parse, print
and pretty-print OCaml code, and ultimately allows one to write abstract
syntax tree preprocessors invoked via the {\tt -ppx} flag (see chapters~\ref{c:camlc}
and~\ref{c:nativecomp}).

It is important to note that the exported front-end interface follows the evolution of the OCaml language and implementation, and thus does not provide {\bf any} backwards compatibility guarantees.

The front-end is a part of "compiler-libs" library.
Programs that use the "compiler-libs" library should be built as follows:
\begin{alltt}
        ocamlfind ocamlc \var{other options} -package compiler-libs.common \var{other files}
        ocamlfind ocamlopt \var{other options} -package compiler-libs.common \var{other files}
\end{alltt}
Use of the {\tt ocamlfind} utility is recommended. However, if this is not possible, an alternative method may be used:
\begin{alltt}
        ocamlc \var{other options} -I +compiler-libs ocamlcommon.cma \var{other files}
        ocamlopt \var{other options} -I +compiler-libs ocamlcommon.cmxa \var{other files}
\end{alltt}
For interactive use of the "compiler-libs" library, start "ocaml" and
type\\*"#load \"compiler-libs/ocamlcommon.cma\";;".

% Some of the files below are commented out as the documentation is too poor
% or they are thought to be nonessential.


\begin{linklist}
\ifouthtml%
% Ast_helper is excluded from the PDF and text manuals.
% It is over 20 pages long and does not have doc-comments. It is expected
% that Ast_helper will be only useful in the HTML manual (to look up signatures).
\compilerdocitem{Ast_helper}{helper functions for AST construction}
\fi%
\compilerdocitem{Ast_mapper}{-ppx rewriter interface}
\compilerdocitem{Asttypes}{auxiliary types used by Parsetree}
% \item \ahref{compilerlibref/Lexer.html}{Module \texttt{Lexer}: OCaml syntax lexing}
\compilerdocitem{Location}{source code locations}
\compilerdocitem{Longident}{long identifiers}
\compilerdocitem{Parse}{OCaml syntax parsing}
\compilerdocitem{Parsetree}{OCaml syntax tree}
\compilerdocitem{Pprintast}{OCaml syntax printing}
% \item \ahref{compilerlibref/Printast.html}{Module \texttt{Printast}: AST printing}
\end{linklist}
