caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: Emmanuel.Engel@lri.fr (Emmanuel Engel)
Cc: caml-list@inria.fr
Subject: Re: Grammaires et pretty print
Date: Tue, 2 Dec 1997 21:58:55 +0100 (MET)	[thread overview]
Message-ID: <199712022058.VAA02811@jaune.inria.fr> (raw)
In-Reply-To: <348402F1.D25@lri.fr> from Emmanuel Engel at "Dec 2, 97 01:45:37 pm"

[English version further]

> J'ai une  question sur les  grammaires et le pretty-print. Chaque fois
> que je doit debugger un programme, je suis toujours plus ou moin amene
> a definir des pretty printer
> ...
> De tels outils n'existent pas. Il doit y  avoir une bonne raison, quel
> est le point que j'ai loupe ??

Le problème est que ça marche bien pour les grammaires simples. Dès
que ça se complique un peu, ça ne marche plus aussi bien. En plus, pour
peaufiner le truc, il faut ajouter des directives de pretty print
(ajouter des blancs, des breaks, etc).

Néanmoins, je suis d'accord, personnellement, quand je fais un pretty
printer, et en particulier ceux de Camlp4, pr_o et pr_r, je les
écrits symétriquement des parseurs (mais manuellement), en reprenant
les mêmes noms de fonctions. C'est bien pratique. Mais, à mon sens, je
trouve que ça ne s'automatise pas très bien.

Avant tout, il manque peut-être déjà une couche au dessus de Format,
par exemple de la syntaxe pour ce module. J'ai ça dans un coin. Mais,
comme je n'utilise pas Format dans mes pretty prints de Camlp4, je
n'ai pas eu l'occasion de la bien tester.

----------

[Question why there are no automatic pretty printers provided with
grammars camlyacc and Camlp4]

The problem is that it works well for simple grammars. When they
become more complicate, it is not so easy. Moreover, when you want to
ameliorate the thing, you have to add directives of pretty print
(spaces, breaks, etc).

I agree with you: personnally, when I make pretty printers, e.g. those
of Camlp4, pr_r and pr_o, I write them symmetrically of the parsers
(but manually), with the same names for the functions. It is Ok. But,
according to me, I think it is difficult to automaticize.

First, I think that a layer above Format is missing, for example some
syntax for this module. I wrote something. But, because I do not use
Format for my pretty printers of Camlp4, I did not test this syntax
much.

--------------------------------------------------------------------------
 Daniel de RAUGLAUDRE

 Projet Cristal - INRIA Rocquencourt
 Tel: +33 (01) 39 63 53 51
 Email: daniel.de_rauglaudre@inria.fr
 Web: http://pauillac.inria.fr/~ddr/
--------------------------------------------------------------------------





  reply	other threads:[~1997-12-03 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-02 12:45 Emmanuel Engel
1997-12-02 20:58 ` Daniel de Rauglaudre [this message]
1997-12-03 17:38   ` Pierre Weis
1997-12-07 15:30 ` Grammars and " Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199712022058.VAA02811@jaune.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=Emmanuel.Engel@lri.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).