Go to the first, previous, next, last section, table of contents.


Installation

HereDoc has been developped on a Linux box, with:

  1. OCaml 3.00
  2. Camlp4 3.00

To install HereDoc, just untar the distribution tarbal, and do:

make HereDoc

This will produce the files:

pa_HereDoc.cma, text.cmo, text.cmx

To compile a file with the HereDoc syntax, you must pass to the compiler the option:

-pp 'camlp4o pa_HereDoc.cmo'

(put the correct path to pah_HereDoc.cmo).

To link, you'll probably need text.cmo (for the bytecode compiler) or text.cmx (for the native compiler).

To gain a better understanding of HereDoc, you may want to see the plain OCaml code it produces. First, you should build a version of HereDoc producing source code instead of an abstract syntax tree representation :


mkcamlp4 -o HereDoc_dump str.cma pa_o.cmo pr_o.cmo hereDoc_lexer.cmo pa_HereDoc.cmo

or simply:


make HereDoc_dump

Then, for instance:

./HereDoc_dump yourfile.ml

CamlP4 can't print everything, so the result of HereDoc_dump may not be usable as an input for OCaml.

Have a look at the Makefile and the files doc.ml, doc.layout.tpl, doc.sections.tpl (the source code for this page). They illustrate the use of HereDoc.


Go to the first, previous, next, last section, table of contents.