bug-bison
[Top][All Lists]
Advanced

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

Re: Production rules don't have the default action


From: Akim Demaille
Subject: Re: Production rules don't have the default action
Date: Tue, 23 Jun 2015 21:54:41 +0200

Hi Eduardo,

> Le 30 mai 2015 à 02:02, Eduardo Madrid <address@hidden> a écrit :
> 
> On Bison's manual:
> 
> http://www.gnu.org/software/bison/manual/html_node/Actions.html
> 
> 
> It states that
> 
> ?If you don't specify an action for a rule, Bison supplies a default: $$ = $1

The bug is in the documentation: this default rule is not applied
when you are using variants.  That's a feature.

Actually, it should not be called "default rule", it is in reality
a "pre-action" which is always performed before the user's action.
In the case of C, where basically you're just toying with pointers,
it makes quite equivalent to actually being a default rule.  In the
case of C++ objects with constructors etc. it's not quite the same
business.

There is however still a pre-action: $$ is default-constructed.


reply via email to

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