[Top][All Lists]

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

Production rules don't have the default action

From: Eduardo Madrid
Subject: Production rules don't have the default action
Date: Sat, 30 May 2015 00:02:08 +0000

On Bison's manual:


It states that

?If you don't specify an action for a rule, Bison supplies a default: $$ = $1

However, the attached grammar does not initialize $$ to $1 on the rule in line 

recursion_1: reduction_by_2 // should have default $$ = $1

The program writes 'Top 0' instead of Top 7.

If the default action is put explicitly { $$ = $1 } then it does.

I detected the problem after arduous debugging of a large grammar that was 
converted from using plain C and distilled to a small example, it seems a 
reduction of 1 symbol works, but not reductions of two or more.

There is no mention in the documentation that I have found of cases in which 
the default action for non-empty rules is not issued.

To replicate: bison vb.y && g++ vb.tab.c


Thanks in advance for considering this bug.

is for the designated recipient only and may contain privileged, proprietary, 
or otherwise private information. If you are not the intended recipient or 
otherwise believe that you have received this message in error, please notify 
the sender immediately and delete the original. Any other use of this message 
or distribution by you is prohibited. If this message was misdirected, Crabel 
Capital Management does not waive any confidentiality or privilege. Investment 
in our programs involves significant risks. There can be no assurance that the 
programs will be able to realize their objectives. An investment in any of our 
programs is speculative and should not be considered by an investor who cannot 
afford the total loss of his/her investment.

Attachment: vb.y
Description: vb.y

reply via email to

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