bison-patches
[Top][All Lists]
Advanced

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

Re: <reductions>


From: Wojciech Polak
Subject: Re: <reductions>
Date: Tue, 16 Oct 2007 19:44:30 +0200

On 2007-10-14 at 15:53 -0400, Joel E. Denny wrote:

> >     <nonterminals>
> >       <nonterminal type="9" symbol="$accept">
... 
> >       </nonterminal>
> >     </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 my mind, a nonterminal or terminal *is* a symbol.  It doesn't
> *have* a symbol attribute.  It does have a "name".

Sure, I know both are symbols.
For grammar/rules/rule/rhs/ I made a "symbol" element with a "class"
attribute (nonterminal|terminal) and "name" as this element value.
I guess this is the form you would like to see in grammar/terminals
and ->/nonterminals.

Now, I'm trying to recall why I chose grammar/terminals/terminal
and grammar/nonterminals/nonterminal and it seems that the only
reason was to maintain a certain logic in the naming, so that the
element named in plural (<terminals>) contains several elements named
in singular (<terminal>), etc.

> 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.

Uhm, I'm also trying to recall why I chose "type" and can't find
any good reason -- seems like my mistake. Obviously it should be
"number".

Regards,
Wojciech






reply via email to

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