bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Visibility and error messages (in named refs).


From: Alex Rozenman
Subject: Visibility and error messages (in named refs).
Date: Sat, 11 Jul 2009 19:19:34 +0300

Hi Akim, Hi Joel, Hi All,

I would like to return to our discussion about visibility and error
messages, because the current situation, in my opinion, is not satisfying.
Now we have a possibility to change things, but when the version will be
released it will be much more complicated to do.

Let's say you start with the following grammar:

> stmt: IF expr THEN stmt ';'
> { $$ = new StmtObj($expr, $stmt); };
>

You get the following:

> test1.y:7.27-31: ambiguous reference: `$stmt'
> test1.y:6.1-4:   refers to: $stmt at $$
> test1.y:6.20-23:   refers to: $stmt at $4
>

OK, you quickly figure out that 'stmt' is ambiguous because it can also
refer to LHS. You change the grammar as the following (very natural, IMHO):
stmt[result]: IF expr THEN stmt ';'
{ $$ = new StmtObj($expr, $stmt); };

And then, you're surprised by the following:

> test1.y:7.27-31: misleading reference: `$stmt'
> test1.y:6.6-11:   possibly meant: $result, hiding $stmt at $$
> test1.y:6.28-31:   refers to: $stmt at $4

Your conclusions: 1) it's unclear how to get rid of this disturbing LHS ???,
2) the error message advices you to write $stmt in order to address $4, but
this is exactly what you currently have! At this point you probably return
to positional references ($4).

It could be suggested that we can improve the error message, but I think
that it shows more serious problem. If we decided that explicit references
hide implicit ones, we *must* did it completely, i.e. when user writes
stmt[result], this 'stmt' must go away from the resolution scope. The
current behaviour is very hard to explain and to document.

My second point is about reference to symbols with dots and dashes.
Currently we have an error in this case. I think that a warning would be
enough when no ambiguity possible.

I also would very appreciate opinions from more people who now is able to
test this feature in thier own versions. I really want to get more
information and inputs about these questions.

-- 
Best regards,
Alex Rozenman (address@hidden).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]