bison-patches
[Top][All Lists]
Advanced

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

[PATCH] Re: named references


From: Alex Rozenman
Subject: [PATCH] Re: named references
Date: Wed, 18 Mar 2009 13:08:07 +0200

Hi Joel,

Thank you very much for you comments. They were really valuable.

I attached a new version of the patch. As you certainly know, it often
happens that accurate implementation changes feelings about how stuff should
work. My current approach is a little bit different from the "consensus" we
had and based on actual symbols (and symbol names) presented in the
production. It is based on a very simple principle - report all possible
ambiguities carefully; compile silently when there are no possible
ambiguities. I copied some examples of bison's output for various
combinations of issues. I agree that "too" smart implementations are often
inappropriate, but clear and understandable error messages may help.

Please note that "asymmetric renaming" warning is not implemented (yet). You
may consider it "disabled" in the following examples. Actually, I am not
sure that it would be helpful.

/* an idyllic case */
if_stmt: IF expr THEN stmt.list[then] ELSE stmt.list[else] FI
           { $if_stmt = new IfStmt($expr, $then, $else); };
<no errors, no warnings>

/* a real ambiguity reported regardless of dots, note that dots cannot
    be a reason for these ambiguities */
if_stmt: IF expr THEN stmt.list ELSE stmt.list FI
           { $if_stmt = new IfStmt($expr, $stmt.list, $stmt.list); };
interpreter.ypp:74.43-52: reference is ambiguous: `$stmt.list'
interpreter.ypp:73.23-31: (may refer to: `stmt.list')
interpreter.ypp:73.38-46: (may also refer to: `stmt.list')
interpreter.ypp:74.55-64: reference is ambiguous: `$stmt.list'
interpreter.ypp:73.23-31: (may refer to: `stmt.list')
interpreter.ypp:73.38-46: (may also refer to: `stmt.list')

/* an ambiguity because of dot issue; there is an additional
    explaination */
if_stmt: IF expr THEN stmt ELSE stmt.list FI
           { $if_stmt = new IfStmt($expr, $stmt, $stmt.list); };
interpreter.ypp:74.50-59: reference is ambiguous: `$stmt.list'
interpreter.ypp:73.23-26: (may refer to: `stmt')
interpreter.ypp:73.33-41: (may also refer to: `stmt.list')
interpreter.ypp:74.50-59: (you may consider using `$[stmt]' or
`$[stmt.list]')

/* no ambiguity possible, ".list" interpreted as a field */
if_stmt: IF expr THEN stmt[then] ELSE stmt FI
           { $if_stmt = new IfStmt($expr, $then, $stmt.list); };
<no errors, no warnings>

/* using of mid-rule action */
if_stmt: IF expr { $<stmtptr>cond = $expr > 0; } [cond] THEN stmt[then] ELSE
stmt FI
           { $if_stmt = new IfStmt($<stmtptr>cond, $then, $stmt.list); };
<no errors, no warnings>

/* forbidden access from mid-rule action */
if_stmt: IF expr { $if_stmt = $then; } [cond] THEN stmt[then] ELSE stmt FI
           { $if_stmt = new IfStmt($<stmtptr>cond, $then, $[stmt].list); };
interpreter.ypp:73.20-27: `$if_stmt' cannot be accessed from mid-rule action
interpreter.ypp:73.31-35: `$then' cannot be accessed from mid-rule action

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