[Top][All Lists]

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

symbol declarations after rules

From: Joel E. Denny
Subject: symbol declarations after rules
Date: Thu, 22 Jun 2006 05:31:34 -0400 (EDT)

I'd like to make Bison report an error if the grammar declares a type, 
destructor, or printer for a symbol after that symbol has appeared in a 
rule.  For example:

  %union {
    int val;
  start: 'a' {  } ;
  %type <val> 'a';
  %destructor { } 'a';
  %printer { } 'a';

Otherwise, Bison can't reliably compute type and destructor warnings for a 
rule when it parses that rule.  I'm not sure if a similar issue for 
printers will arise.

Agreed?  Is there anything else like this?

By the way, Bison 2.3 has no problem with the above.  Bison built from the 
current CVS sources does this:

  tmp.y: warning: 1 useless nonterminal and 1 useless rule
  tmp.y:5.12-15: warning: useless nonterminal: @1
  tmp.y:5.12-15: warning: useless rule: @1: /* empty */
  *** glibc detected *** double free or corruption (out): 0x0808d990 ***

I don't have time to track this down at the moment.


reply via email to

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