caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OCaml IDE (Camlp4 for code formatting)
Date: Tue, 21 Jun 2005 17:18:26 +0200	[thread overview]
Message-ID: <rlslzbeo1p.fsf@ithif59.inf.tu-dresden.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0506210942400.14091@point>

"Nathaniel J. Gaylinn" <ngaylinn@cs.brown.edu> writes:

   On Tue, 21 Jun 2005, Hendrik Tews wrote:
   
   >    I understand why it makes this change,
   >
   > Could you explain? (Because I don't understand. "let _ = 5" and
   > "5" are different internally.)
   
   Heh, I didn't realize that they were handled different internally  ;)  I
   thought it was a reasonable thing to do because it is more explicit and
   equivalent, but if it isn't actually equivalent...
   
Not sure if you got me right: The two phrases "let _ = 5" and "5"
are semantically equivalent and probably compiled to the same
code. However, they have a different representation as a camlp4
ast. Still the question remains, why camlp4 rewrites one into the
other.

   Would it be difficult to write a printer that had much direct access with
   the original file? That's something that I'd quite obviously need.
   
If you pretty print an camlp4 ast similar to pr_o.cmo then you
will always change the input (ie. rewriting "(1,2)" into "1,2" or
vice versa). I don't think it makes sense to track the input to
recover the information that is not present in camlp4's ast,
because you would have to parse the input.

If you want to output all comments and print "(1,2)" as "(1,2)"
and "1,2" as "1,2" then you need a new parser for ocaml. Camlp4
won't help much in this case. It is probably easier to adjust the
yacc grammar from the ocaml sources.

Bye,

Hendrik


  reply	other threads:[~2005-06-21 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 20:08 Nathaniel J. Gaylinn
2005-06-21 10:33 ` [Caml-list] " Hendrik Tews
2005-06-21 13:47   ` Nathaniel J. Gaylinn
2005-06-21 15:18     ` Hendrik Tews [this message]
2005-06-21 18:11       ` David Brown
2005-06-29 14:54         ` [Caml-list] Keyboard interrupt in Windows Nathaniel J. Gaylinn
2005-06-29 16:13           ` Christopher A. Watford

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=rlslzbeo1p.fsf@ithif59.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@yquem.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).