Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
a Lout style for prettyprinting OCAML
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1998-12-14 (09:01)
From: Basile STARYNKEVITCH <Basile.Starynkevitch@c...>
Subject: a Lout style for prettyprinting OCAML

[[posted to Lout & Caml lists]]


For those that are interested, I coded (in OCAML) a tiny style for
prettyprinting OCAML in LOUT.

If you don't know what OCAML is, look at
"". In short, OCAML is a strongly typed
functional programming langage with object extensions (and a good
bytecode & native compiler implementation). OCAML is developped at
INRIA France. It is freely available with sources.

If you don't know what LOUT is, look at
"". In short, LOUT is a text
formatter (similar to LaTeX in spirit) able to format part of text
with arbitrary program filters. Lout generates (color) PostScript &
PDF. Lout is freely available with sources (GPL-ed), written by Jeff
Kingston (

I wrote a small OCAML lexer caml2lout to output Lout commands and a
small camlprint LOUT style to run this caml2lout filter.

As a result, you can embed true OCAML code in your Lout document, like:

Lout at this
@CenteredDisplay @OCAML {
let sumf_r a f = 
  let rec sumloop i s = 
    if (i<0) then s else sumloop (i-1) (s +. f a.(i)) 
  in sumloop (Array.length a - 1) 0.0;;
[1;2] @ [3;4];;


and Lout (with my package & filter) print Ocaml code with keywords in
bold, comments in italics, etc...

If you want this tiny stuff (caml2lout.mll in Ocaml & camlprint in
Lout), ask me. I'll probably be able to give it (but I have no ftp
site, sorry).

N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DRN/DMT/SYSCO * CEA/Saclay bat.460 * 91191 GIF/YVETTE CEDEX * France
fax: (33) 1,; phone: 1,; home: 1,
email: Basile point Starynkevitch at cea point fr