* [Caml-list] pretty-printing with camlp4
@ 2002-02-05 12:17 Markus Mottl
2002-02-05 13:03 ` Daniel de Rauglaudre
0 siblings, 1 reply; 4+ messages in thread
From: Markus Mottl @ 2002-02-05 12:17 UTC (permalink / raw)
To: OCAML
Hello,
I would like to adapt pretty-printing of OCaml-sources with camlp4 to
match my style. What would be the best way to go about this? Just copy
e.g. camlp4/etc/pr_o.ml and change it to my needs? Or are there more
convenient ways to parameterize the existing pretty-printers (quite
complex stuff)?
People might find a transition between syntaxes easier if they can
parameterize pretty-printers for automatic conversion so that they end
up with sources that match their style very closely.
I have played around a bit with pretty-printing some of my existing
sources and would say that translating them to e.g. revised syntax would
be almost zero effort if I could easily tweak the pretty-printers a
bit here and there. In fact, I have already seen more badly formatted
OCaml-code written by humans, which indicates that feeding external
sources through the pretty-printers might always be a good idea... ;)
Regards,
Markus Mottl
--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pretty-printing with camlp4
2002-02-05 12:17 [Caml-list] pretty-printing with camlp4 Markus Mottl
@ 2002-02-05 13:03 ` Daniel de Rauglaudre
2002-02-05 14:13 ` Remi VANICAT
2002-02-05 14:15 ` Markus Mottl
0 siblings, 2 replies; 4+ messages in thread
From: Daniel de Rauglaudre @ 2002-02-05 13:03 UTC (permalink / raw)
To: caml-list
Hi,
On Tue, Feb 05, 2002 at 01:17:05PM +0100, Markus Mottl wrote:
> I would like to adapt pretty-printing of OCaml-sources with camlp4 to
> match my style. What would be the best way to go about this? Just copy
> e.g. camlp4/etc/pr_o.ml and change it to my needs?
You can do that indeed, but my pretty printer is badly written, it is
probably difficult to understand. I should rewrite it using Format one
day, but it is a big work.
--
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pretty-printing with camlp4
2002-02-05 13:03 ` Daniel de Rauglaudre
@ 2002-02-05 14:13 ` Remi VANICAT
2002-02-05 14:15 ` Markus Mottl
1 sibling, 0 replies; 4+ messages in thread
From: Remi VANICAT @ 2002-02-05 14:13 UTC (permalink / raw)
To: caml-list
Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr> writes:
> Hi,
>
> On Tue, Feb 05, 2002 at 01:17:05PM +0100, Markus Mottl wrote:
>
> > I would like to adapt pretty-printing of OCaml-sources with camlp4 to
> > match my style. What would be the best way to go about this? Just copy
> > e.g. camlp4/etc/pr_o.ml and change it to my needs?
>
> You can do that indeed, but my pretty printer is badly written, it is
> probably difficult to understand. I should rewrite it using Format one
> day, but it is a big work.
by the way, if you have the file spretty_option.ml :
-- begin of file --
value set_dt x =
Spretty.dt.val := x
;
value set_tol x =
Spretty.tol.val := x
;
value set_sp st =
Spretty.sp.val := Token.eval_char st
;
Pcaml.add_option "-dt" (Arg.Int set_dt) "change dt value";
Pcaml.add_option "-tol" (Arg.Int set_tol) "change tol value";
Pcaml.add_option "-sp" (Arg.String set_sp) "change sp value";
-- end of file --
(compile with :
ocamlc -I +camlp4 -pp camlp4r -c spretty_option.ml
)
then camlp4 will have 3 new option : -dt -tol and -sp that will
change some pretty printer action :
- tol seem to change the way you indent in a long application
- dt is the default indentation
- sp is the space char (not sure it may be useful to change it)
(just try).
--
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] pretty-printing with camlp4
2002-02-05 13:03 ` Daniel de Rauglaudre
2002-02-05 14:13 ` Remi VANICAT
@ 2002-02-05 14:15 ` Markus Mottl
1 sibling, 0 replies; 4+ messages in thread
From: Markus Mottl @ 2002-02-05 14:15 UTC (permalink / raw)
To: Daniel de Rauglaudre; +Cc: caml-list
On Tue, 05 Feb 2002, Daniel de Rauglaudre wrote:
> On Tue, Feb 05, 2002 at 01:17:05PM +0100, Markus Mottl wrote:
> > I would like to adapt pretty-printing of OCaml-sources with camlp4 to
> > match my style. What would be the best way to go about this? Just copy
> > e.g. camlp4/etc/pr_o.ml and change it to my needs?
>
> You can do that indeed, but my pretty printer is badly written, it is
> probably difficult to understand. I should rewrite it using Format one
> day, but it is a big work.
Indeed, it's quite complex. It would be really nice to see it use the
Format-module...
Regards,
Markus Mottl
--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-02-05 14:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-05 12:17 [Caml-list] pretty-printing with camlp4 Markus Mottl
2002-02-05 13:03 ` Daniel de Rauglaudre
2002-02-05 14:13 ` Remi VANICAT
2002-02-05 14:15 ` Markus Mottl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox