RE: [sv-bc] $bits question

From: Steven Sharp <sharp_at_.....>
Date: Fri Jan 13 2006 - 11:19:15 PST
>From: "Rich, Dave" <Dave_Rich@mentor.com>

>I seem to recall a big debate about whether to allow anonymous types in
>places other than in the declaration of a variable, but I don't remember
>the reason why we agreed to allow it and not require an intermediate
>typedef. I think it is one of those things that would take more effort
>to define than its worth, but I would support a proposal.

I think the only type it should allow is a type name.  Since $bits is
essentially a special system function, its argument should have the
same syntax as a system function argument: the syntax of an expression.
It has a special semantic rule that allows the argument to be a type
name, but the syntax still matches an expression.  Having the parser
accept a completely different syntax in an argument to $bits than any
other argument is inconsistent.  And what if it turns out that $bits has
been overridden with a user-defined system task of the same name?  Then
completely different syntactic rules should have been used.

And it really isn't difficult to define.  The mistake was in trying
to have the BNF allow a type, by using the grammar production for
a general type.  The difference between a type identifier and a
variable identifier is not syntactic, but semantic.  The BNF should
not be trying to enforce that distinction.  The BNF should instead allow
an expression, which allows all the desired syntax, and then have a
special semantic rule that says that a type identifier is a legal 
argument in $bits.  In fact, once you have done this, there is no need
to have separate BNF for $bits.  Its syntax becomes the same as any
other system function call.


Steven Sharp
sharp@cadence.com
Received on Fri Jan 13 11:19:22 2006

This archive was generated by hypermail 2.1.8 : Fri Jan 13 2006 - 11:19:50 PST