bison-patches
[Top][All Lists]
Advanced

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

symbolic names - an updated version


From: Alex Rozenman
Subject: symbolic names - an updated version
Date: Sat, 16 May 2009 18:01:55 +0300

Hi Akim, Joel,

I prepared a new version of my modification. I changed format of error
messages and somewhat improved the code. I also supported dashes in implicit
(as well as in explicit) symbol references.

Currently, the bison output is going like the following:

if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI
          { $if_stmt1 = new IfStmt($cond1, $then.f1, $else); };
interpreter.ypp:67.36-41: symbol not found: `$cond1'

if_stmt2: IF expr[cond] THEN stmt[then] FI
          { $if_stmt2 = new IfStmt($cond, $stmt.field, 0); };
interpreter.ypp:70.43-53: reference is invalid: `$stmt.field'
interpreter.ypp:69.35-38:   possibly meant: $then.field at $4, `stmt' is
hidden

if_stmt3: IF expr[cond] THEN stmt.list FI
          { $if_stmt3 = new IfStmt($cond, $stmt.list, 0); };
interpreter.ypp:73.43-52: reference is invalid: `$stmt.list'
interpreter.ypp:72.30-38:   possibly meant: $[stmt.list] at $4

if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
          { $if_stmt4 = new IfStmt($cond, $xyz, $cond); };
interpreter.ypp:76.43-46: reference is ambiguous: `$xyz'
interpreter.ypp:75.35-37:   refers to: $xyz at $4
interpreter.ypp:75.50-52:   refers to: $xyz at $6

if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
          { $if_stmt5 = new IfStmt($cond, $stmt.list, $else); };
interpreter.ypp:79.43-52: reference is invalid: `$stmt.list'
interpreter.ypp:78.40-43:   possibly meant: $then at $4, `stmt.list' is
hidden
interpreter.ypp:78.61-64:   possibly meant: $else at $6, `stmt.list' is
hidden

if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
          { $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); };
interpreter.ypp:82.43-58: reference is invalid: `$stmt.list.field'
interpreter.ypp:81.40-43:   possibly meant: $then.field at $4, `stmt.list'
is hidden
interpreter.ypp:81.61-64:   possibly meant: $else.field at $6, `stmt.list'
is hidden

if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
          { $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); };
interpreter.ypp:85.43-54: reference is invalid: `$[stmt.list]'
interpreter.ypp:84.40-43:   possibly meant: $then at $4, `stmt.list' is
hidden
interpreter.ypp:84.61-64:   possibly meant: $else at $6, `stmt.list' is
hidden

if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
          { $if_stmt8 = new IfStmt($cond, $then.1, $else); };
interpreter.ypp:88.43-49: reference is invalid: `$then.1'
interpreter.ypp:87.40-45:   possibly meant: $[then.1] at $4

if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
          { $if_stmt9 = new IfStmt($cond, $then.1.field, $else); };
interpreter.ypp:91.43-55: reference is invalid: `$then.1.field'
interpreter.ypp:90.40-45:   possibly meant: $[then.1].field at $4

if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
          { $if_stmt10 = new IfStmt($cond, $stmt.x, 0); };
interpreter.ypp:94.44-50: reference is invalid: `$stmt.x'
interpreter.ypp:93.36-41:   possibly meant: $[stmt.x].x at $4, `stmt' is
hidden
interpreter.ypp:93.36-41:   possibly meant: $[stmt.x] at $4

if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
          { $if-stmt-a = new IfStmt($cond, $then, $else); };
interpreter.ypp:97.13-22: reference is invalid: `$if-stmt-a'
interpreter.ypp:96.1-9:   possibly meant: $[if-stmt-a] at $$

if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
          { $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else);
interpreter.ypp:100.46-54: reference is invalid: `$then-a.f'
interpreter.ypp:99.41-46:   possibly meant: $[then-a].f at $4

Some points:
1. As you can see from the last two examples, dashes are treated exactly
like dots. It means that $symbol-with-dashes reference will be rejected and
a bracketing will be required. On the other hand, symbols like 'if-stmt-a'
look much more "together" than 'stmt.list', and it is very possible, that in
someone eyes, it would be much more natural to allow $if-stmt-a without
bracketing (but '-' is a subtraction in C!). I am still not sure that such a
inflexible implementation is the right thing.
2. In example with if_stmt10 there is a very corner case when the reference
is compatible both with the implicit and the explict references. The error
message generated in this case looks, at least, hard to understand (but it
is correct). How can we improve it ?
3. I also not sure that the style of error messages when I'm directly
replacing the referenced symbol by an explicit reference (as in if_stmt2) is
understandable by users. The error message points to an expression that user
never wrote. I'm in favour of adding words "suggestion" or "you may write"
into the text.

As per you request, I deleted generated files from the patch (however, I
have no idea what's the correct way to do in git. I'm just not committing
them, but then I have a problems during "git-pull").

I sent my documents to FSF a two weeks ago, I hope they're already there.

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

Attachment: 0001--Implement-support-for-named-symbol-references.patch
Description: Text Data


reply via email to

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