Re: [sv-bc] enum range with keyword

From: Greg Jaxon <Greg.Jaxon@synopsys.com>
Date: Mon Mar 22 2010 - 13:25:09 PDT
As a current interpretation, I think Dave is correct about "reg" or "endmodule" not parsing smoothly.
I don't consider that to be the desired behavior, though.  There are other spots where keywords
cease to function as keywords, we just forgot to make that exception here.

`define for_example(begin,reg,end)  begin \
                                      reg A; \
                                      always A=`enumeral(pull,0); \
                                    end

`define enumeral(enum,index) \``enum``index

`for_example( module m();, enum{pull[2]}, endmodule )


For currently legal identifiers that would yield keyword enumerals, I don't see any benefit to making
them illegal.  The colliding cases will be harder to use, which will motivate a rewrite, but not require it.

Rich, Dave wrote:
IMHO, This is illegal per the BNF.
enum {reg[2] }  e;

cannot be parsed because reg will be returned as a keyword token, not an identifier.

 

As far as

enum {pull[2] }  e;

is concerned, this is currently legal syntax, but you would never be able to reference pull0 or pull1 from within your code. We either need to make this illegal (preferred) or say that any formed identifier that matches a keyword must be escaped.

 

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Greg Jaxon
Sent: Monday, March 22, 2010 10:45 AM
To: David Jones
Cc: Bresticker, Shalom; sv-bc@eda.org
Subject: Re: [sv-bc] enum range with keyword

 

AFAIK, \pull0  is available as an identifier with the same spelling as the keyword.
BTW, I really like "enumerals" did you coin that word?

David Jones wrote:

Another case: is it legal for the base name to be something like
"pull" or "notif"? These are not keywords, but the generated enumerals
"pull0", "pull1", "notif0", "notif1" are.
 
On Mon, Mar 22, 2010 at 9:31 AM, Bresticker, Shalom
<shalom.bresticker@intel.com> wrote:
  
Is it legal to define an enum constant range with a keyword as a base name:
 
enum {reg[2] }  e;
 
On the one hand, 'reg' is a keyword.
On the other hand, the names being generated are reg0 and reg1.
 
I think it would not be allowed.
 
Thanks,
Shalom
 
Shalom Bresticker
Intel LAD DA, Jerusalem, Israel
+972  2 589 6582 (office)
+972 54 721 1033 (cell)
http://www.linkedin.com/in/shalombresticker
 
 
 
---------------------------------------------------------------------
Intel Israel (74) Limited
 
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
 
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
    
 
  


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Mon Mar 22 13:25:27 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 22 2010 - 13:25:33 PDT