From: Damien Doligez <damien.doligez@inria.fr>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] 3.07: debug information on camlp4-processed files is missing the file name?
Date: Wed, 7 Jan 2004 13:50:50 +0100 [thread overview]
Message-ID: <1F5153C0-4110-11D8-BEFF-00039310CAE8@inria.fr> (raw)
In-Reply-To: <3FFB9D6B.6020704@cs.caltech.edu>
On Wednesday, January 7, 2004, at 06:47 AM, Aleksey Nogin wrote:
> Character 20504 in the file is indeed "line 560, character 63", but
> "character 22067" is not the same as "line 595, character 11".
>
> the code in question is:
>
> ...
> else begin
> if ...
>
> and non-camlp4 "line 595, character 11" one points to the space
> between "else" and "begin", while camlp4's "character 22067" points to
> the space right before the "if".
In both cases, it's not the space right before, but the first character
of. Because we used zero-based character numbers (the first character
of
the line is character 0).
If you're interested in the reasons for the difference, here is the
story:
begin...end is like a pair of parentheses. It is used by the parser
to disambiguate the expression, but it doesn't appear explicitely
in the abstract syntax tree. Hence we have to choose, when we parse
"begin 1 + 2 end" whether the location of the expression is only
the inner expression "1 + 2" or the whole thing.
Originally, it was the inner expression, because it's the natural
way of writing the parser. I changed it for cosmetic reasons related
to type display (option -dtypes and caml-types.el). I changed it
in the yacc-based parser but not (yet) in the camlp4 parsers, hence
the discrepancy.
> P.S. Why would an exception (supposedly raised inside the "true"
> branch of an if) be re-raised at the end of the "if" branch?
I don't know. Maybe because the "inside" is a call to a primitive, and
the "if branch" is the smallest OCaml expression that contains it ?
-- Damien
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-01-07 12:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-05 19:27 Aleksey Nogin
2004-01-05 20:18 ` Damien Doligez
2004-01-07 5:47 ` Aleksey Nogin
2004-01-07 12:50 ` Damien Doligez [this message]
2004-01-08 1:29 ` Aleksey Nogin
2004-01-08 8:17 ` Stefano Zacchiroli
2004-01-08 9:49 ` Damien Doligez
2004-01-08 15:38 ` skaller
2004-01-09 10:46 ` Damien Doligez
2004-01-10 11:15 ` skaller
2004-01-09 8:41 ` Stefano Zacchiroli
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=1F5153C0-4110-11D8-BEFF-00039310CAE8@inria.fr \
--to=damien.doligez@inria.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