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
Pretty-printer and tabulation boxes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <weis@p...>
Subject: Re: Pretty-printer and tabulation boxes
> Bonjour,
> Travaillant `a la r'ealisation d'un pretty-printer en Objective Caml,
> je souhaiterais utiliser toutes les possibilit'ees offertes par le
> module "Format". Je suis `a la recherche de quelques exemples
> d'impl'ementation de pretty-printer mettant en oeuvre -si possible-
> les   bo^ites de tabulation (c'est `a dire utilisant 'open_tbox' et
> 'close_tbox'). 

Il y a des exemples d'imprimeurs dans la FAQ de caml 

Malheureusement, il n'y a pas d'exemples avec les boi^tes de
tabulation. Ces boi^tes ne sont pas destine'es a` l'impression
d'arbres mais a` l'impression simple de structures plus line'aires
(tableaux de chiffres par exemple).

De plus, les boi^tes de tabulation obe'issent a` une logique
diffe'rente des boi^tes d'impression habituelles, avec lesquelles
elles ne doivent pas e^tre me'lange'es. (Autrement dit, le module
format imple'mente ces deux types de boi^tes ``en paralle`le'', sans
donner le moyen de les utiliser simultane'ment).

> -----------
> Hello,
> Working at the realisation in Objective Caml of a Pretty-Printer, I
> would like to use all possibilities provided by the "Format"
> module. I'm looking for some existing pretty-printer examples. I'm
> interesting in finding a few which use the tabulation boxes (i.e
> invoking the functions  'open_tbox' and 'close_tbox').

There are some examples of regular pretty-printers in the caml FAQ 

Unfortunately, there is no examples using tabulation boxes.
Note that these boxes are not suitable to print trees but can be use to print
simpler structures (more linear than trees), for instance integer arrays.
Moreover, the tabulation mechanism is different from regular boxes:
hence you may not mix both kind of boxes in the same program.
(In a sense, the format module provides two distinct implementations
for these two styles of boxes into the same file).

Pierre Weis

INRIA, Projet Cristal,,