Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@ozemail.com.au>
To: Christian Lindig <lindig@cs.uni-sb.de>
Cc: "Rafael 'Dido' Sevilla" <dido@imperium.ph>,
	Caml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] line number information in abstract syntax trees
Date: 19 Sep 2003 05:01:16 +1000	[thread overview]
Message-ID: <1063911675.19351.7.camel@pelican> (raw)
In-Reply-To: <20030917084448.GD8771@st>

On Wed, 2003-09-17 at 18:44, Christian Lindig wrote:
> On Mon, Sep 15, 2003 at 03:53:39PM +0800, Rafael 'Dido' Sevilla wrote:

>   and expr =
>         ExprAt of (expr * region)                   (* <--- *)
>       | Int of (StdPrims.std_string * ty option)

>   This
> representation comes in handy when you create an AST not by parsing,
> but directly. In this case you don't have to invent line numbers because
> you simply never would generate ExprAt nodes. 

This is a false sense of security. Synthesised terms may
also contain errors (for example type errors). Therefore the
error reporting needs to reflect where the error occurred,
which means you need to synthesise an appropriate source reference.

The advantage of mandatory source references (as opposed to the
above style) is that you're *forced* as a programmer to consider
the issue at all times. I sometimes 'cheat' a bit, and dont give
a precise enough reference, but that's better than omiting
one: for every expression, mandatory source references *guarrantee*
the presence of a source reference -- and that assurance is useful
in a product which is 90% error reporting, all of which *should*
relate back to the input source.

In particular this means that term rewriting rules must attempt
to preserve source location data in some sensible way, which is often
somewhat more diffiult than the logic of the rewriting rules themselves.


-------------------
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


  reply	other threads:[~2003-09-18 19:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-15  7:53 Rafael 'Dido' Sevilla
2003-09-15 11:14 ` Michal Moskal
2003-09-16 20:07 ` skaller
2003-09-17  8:44 ` Christian Lindig
2003-09-18 19:01   ` skaller [this message]
2003-09-19  6:50     ` Christian Lindig

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=1063911675.19351.7.camel@pelican \
    --to=skaller@ozemail.com.au \
    --cc=caml-list@inria.fr \
    --cc=dido@imperium.ph \
    --cc=lindig@cs.uni-sb.de \
    /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