bison-patches
[Top][All Lists]
Advanced

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

Re: <reductions>


From: Joel E. Denny
Subject: Re: <reductions>
Date: Sun, 14 Oct 2007 15:53:44 -0400 (EDT)

On Sun, 30 Sep 2007, Joel E. Denny wrote:

>   <grammar>
>     ...
>     <nonterminals>
>       <nonterminal type="9" symbol="$accept">
>         <left>
>           <rule>0</rule>
>         </left>
>       </nonterminal>
>       <nonterminal type="10" symbol="exp">
>         <left>
>           <rule>1</rule>
>           <rule>2</rule>
>           <rule>3</rule>
>           <rule>4</rule>
>           <rule>5</rule>
>         </left>
>         <right>
>           <rule>0</rule>
>           <rule>1</rule>
>           <rule>2</rule>
>           <rule>3</rule>
>           <rule>4</rule>
>         </right>
>       </nonterminal>
>       <useless>
>         <nonterminal symbol="useless1" />
>         <nonterminal symbol="useless2" />
>       </useless>
>     </nonterminals>
>   </grammar>

> It seems to me that the "symbol" attribute above ought to be "name", and 
> "type" ought to be "number".

Wojciech, what do you think about changing these attribute names?

In the context of Bison, the "type" of a symbol usually refers to the 
semantic type, which we may want to print as well at some point.  
"number" is more obvious for your purpose, and it's more consistent with 
the "number" attribute on the "rule" element.

In my mind, a nonterminal or terminal *is* a symbol.  It doesn't *have* a 
symbol attribute.  It does have a "name".  I've seen the term "name" used 
in this way in the Bison manual as well as in the POSIX Yacc 
specification.  By the way, in Bison, a single terminal symbol can have a 
second representation called an alias.




reply via email to

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