help-bison
[Top][All Lists]
Advanced

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

Re: Including nonterminals in tab.h


From: Akim Demaille
Subject: Re: Including nonterminals in tab.h
Date: Fri, 03 Sep 2004 10:17:04 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

No private mails for public matters, thanks!

--- Begin Message --- Subject: Re: Including nonterminals in tab.h Date: Thu, 2 Sep 2004 15:15:19 -0400
Akim,

I'm building a complex syntax tree and I think it will be useful to be able
to use some of the non-terminal names from the grammar as node types rather
than having to define new names.        

Basically I'm just trying to save some typing and debugging.  I'd prefer to
define the node types in the grammar rather than to invent them and spend a
lot of time making sure that everything was in sync.

Perhaps even better would be an extension to the %type directive to provide
a synonym that would be added to tab.h as a define/enum.  The value
generated should be appropriate (i.e. token number) so that it can be used
to access yytname as can be done for terminals (offset of 255).  That would
allow the node types to be upper case (by convention) while retaining the
lower case nonterminal name convention, and still keep the definitions as
part of the grammar file.  In my case, it would also allow selective
specification rather than including the hundreds of nonterminal names.  

Philosophically, yytname allows runtime access to all the symbol names (or
synonyms) based on terminal number.  But tab.h currently allows compile
time access to only the terminal symbol numbers based on their names.  It
seems to me that there should be some way to get compile time access to the
nonterminal symbol numbers based on their names or synonyms. 

Original Message:
-----------------
From: Akim Demaille address@hidden
Date: Thu, 02 Sep 2004 17:14:30 +0200
To: address@hidden, address@hidden
Subject: Re: Including nonterminals in tab.h


>>> "address@hidden" == address@hidden rr com <address@hidden> writes:

 > Hello,

 > Is there a way to have Bison include definitions for the
 > non-terminal symbols in the tab.h file?

What would you use this for?



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .





--- End Message ---

reply via email to

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