English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Behavior of camlp4o when used with -pp?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-02-10 (21:10)
From: Jake Donham <jake@d...>
Subject: Re: [Caml-list] Behavior of camlp4o when used with -pp?
On Tue, Feb 10, 2009 at 12:20 PM, David Rajchenbach-Teller <
David.Teller@ens-lyon.org> wrote:

> camlp4o -no_comments foo.ml
> understands option "-no_comments" correctly and pretty-prints the
> contents of foo.ml, minus comments
> However, when using camlp4o as a preprocessor,
> ocamlc -i -pp "camlp4o -no_comments" foo.ml
> -no_comments: unknown or misused option
> Use option -help for usage
> File "foo.ml", line 1, characters 0-1:
> Error: Preprocessor error

The default Camlp4 printer is the "auto" printer, which checks if its output
fd is a TTY; if so it uses the OCaml printer (which has -no_comments), if
not it uses the DumpOCamlAst printer (which does not). The point of this is
to pass the serialized AST through to the compiler without reparsing, for
speed and also to preserve the original locations in code that's been
transformed by a syntax extension.

Basically there is no reason to use -no_comments with -pp. But if you really
want to you can also give -printer o to camlp4o so you always get the OCaml
printer instead of autoselecting.