caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jake Donham <jake@donham.org>
To: David Rajchenbach-Teller <David.Teller@ens-lyon.org>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Behavior of camlp4o when used with -pp?
Date: Tue, 10 Feb 2009 13:10:24 -0800	[thread overview]
Message-ID: <c7e4e9f0902101310n4995d2b7n89b18b71ef07259c@mail.gmail.com> (raw)
In-Reply-To: <1234297248.6457.65.camel@Blefuscu>

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

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.

Jake

[-- Attachment #2: Type: text/html, Size: 1630 bytes --]

  reply	other threads:[~2009-02-10 21:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 20:20 David Rajchenbach-Teller
2009-02-10 21:10 ` Jake Donham [this message]
2009-02-10 22:05   ` [Caml-list] " David Rajchenbach-Teller

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=c7e4e9f0902101310n4995d2b7n89b18b71ef07259c@mail.gmail.com \
    --to=jake@donham.org \
    --cc=David.Teller@ens-lyon.org \
    --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).