bug-bison
[Top][All Lists]
Advanced

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

Locations and mid-rule actions


From: Frank Heckenbach
Subject: Locations and mid-rule actions
Date: Sat, 18 Dec 2004 01:51:50 +0100
User-agent: semail 20041018

Last year I reported an issue with locations and mid-rule actions
(http://lists.gnu.org/archive/html/bug-bison/2003-06/msg00021.html):

: There seems to be a problem in how bison handles the default
: location action in the presence of mid-rule actions. The attached
: code demonstrates this.
:
: The LALR(1) parser outputs the following, i.e. the parameters to
: YYLLOC_DEFAULT seem to be wrong for the mid-rule action:
:
: LOC 0
: ab
: LOC 4
: abc
:
: The GLR parser omits the YYLLOC_DEFAULT for mid-rule actions
: entirely:
:
: ab
: LOC 4
: abc

Meanwhile things have improved, and GLR behaves like LALR(1) in this
respect.

Back then I wrote:

: AFAICS, it would be reasonable to handle mid-rule actions like
: regular actions, so YYLLOC_DEFAULT can set their address@hidden' from the
: previous symbols (which is needed if the mid-rule action does any
: stuff that needs the current location). So in this example it should
: say `LOC 2' first.

Now I see that the current behaviour can also be useful. Since the
location of the mid-rule action will be a part of the final
location, it seems reasonable to leave it empty.

OTOH, it might not hurt if the mid-rule action has a location that
spans the previous symbols. If it's later merged (in the usual
ways), it wouldn't make any difference.

So what I'm asking is basically just if the current behaviour is the
"documented" official one, and if it might be useful to perhaps add
an option to let the mid-rule action's location span the previous
symbols.

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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