Re: [sv-bc] Macro mantis proposals 1397 & 1478

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Thu Dec 06 2007 - 12:36:23 PST
Brad, you appear to be assuming that all text is expanded and "glued
together" as text prior to tokenizing the final text.  I don't think that
is correct.  The token boundaries for escaped identifiers are not always
delineated  by whitespace in a macro expansion context.  An approach that does
not consider tokenizing as part of macro handling would be incorrect.

For example consider:

    `define EQ =
    module m;
       int x,y;
       initial
          if (x `EQ= y);
    endmodule

the `EQ= does not produce the token "==" and it would be illegal
to consider it as doing so.  The above example should produce
a parse error in a compliant system.

Since an escaped identifier is a token, it cannot be continued
by text outside the macro independent of whether whitespaces
are stripped or not.

This is part of why we need to be exceedingly careful about what
we do and why I've been very hesitant about some of the wording
that has been proposed.  The really describe this all correctly
we have to get out of the mode of thinking of simple text or
simple tokens -- I am fairly convinced that any correct and
compatible approach will have to be a hybrid description that
very carefully deals with when one is thinking about "text"
versus "tokens".

Gord.


Brad Pierce wrote:
> Yet, that's the clear implication of stripping the whitespace from the 
> reasonable macro text in my example.  I don't like the outcome either, 
> but my example shows what the proposal would enable.  My macro uses an 
> escaped identifier, the proposal strips off the terminating whitespace, 
> making it no longer terminated.
>  
> -- Brad
> 
> ------------------------------------------------------------------------
> *From:* owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] *On Behalf Of 
> *Coffin, Eric
> *Sent:* Thursday, December 06, 2007 10:07 AM
> *To:* Bresticker, Shalom
> *Cc:* Brad Pierce; sv-bc@eda.org
> *Subject:* Re: [sv-bc] Macro mantis proposals 1397 & 1478
> 
> I agree with Shalom that a single token cannot be cobbled together from 
> text that is partially in a macro expansion and partially outside of the 
> same macro expansion.  As Shalom stated the LRM is fairly clear on this 
> in section 21.5.1.
> 
> -Eric
> 
> 
> Bresticker, Shalom wrote:
>> You don't agree that joining the macro text with what comes after it
>> would turn the macro text into half a token?
>>
>> Shalom 
>>
>>   
>>> -----Original Message-----
>>> From: owner-sv-bc@server.eda.org 
>>> [mailto:owner-sv-bc@server.eda.org] On Behalf Of Brad Pierce
>>> Sent: Thursday, December 06, 2007 6:19 PM
>>> To: sv-bc@server.eda.org
>>> Subject: RE: [sv-bc] Macro mantis proposals 1397 & 1478
>>>
>>> No, I don't agree.  My macro text ended in an escaped 
>>> identifier.  The proposal would strip off its trailing 
>>> whitespace.  In any case, the example is a natural one for an 
>>> implementer to think of, so the LRM really ought to be clear 
>>> on the point, if only by giving an example.
>>>
>>> -- Brad 
>>>
>>> -----Original Message-----
>>> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On 
>>> Behalf Of Bresticker, Shalom
>>> Sent: Thursday, December 06, 2007 2:31 AM
>>> To: Brad Pierce; sv-bc@eda.org
>>> Subject: RE: [sv-bc] Macro mantis proposals 1397 & 1478
>>>
>>> Brad,
>>>
>>> 1. It is true that 1339 is formally being revoted. However, 
>>> there was informal oral agreement on the last revision of the 
>>> proposal at the most recent meeting.
>>>
>>> 2. Your example probably should not work because of the rule 
>>> that a macro text may not begin or end in the middle of a 
>>> token. The precise LRM text in 21.5 is
>>>
>>> "The text specified for macro text shall not be split across 
>>> the following lexical tokens:
>>> - Comments
>>> - Numbers
>>> - String literals
>>> - Identifiers
>>> - Keywords
>>> - Operators" 
>>>
>>> Do you agree?
>>>
>>> Thanks,
>>> Shalom
>>>
>>>
>>>     
>>>> -----Original Message-----
>>>> From: owner-sv-bc@server.eda.org
>>>> [mailto:owner-sv-bc@server.eda.org] On Behalf Of Brad Pierce
>>>> Sent: Thursday, December 06, 2007 4:30 AM
>>>> To: sv-bc@server.eda.org
>>>> Subject: RE: [sv-bc] Macro mantis proposals 1397 & 1478
>>>>
>>>>       
>>>>> Mantis 1339 has been approved which adds the last sentence below:
>>>>>         
>>>> Mantis 1339 is still being considered by the current e-mail vote.  
>>>> Also, I added the following bugnote to it
>>>>
>>>> --------------------------
>>>>
>>>> It would be nice to see an example of what this proposal means for 
>>>> macro texts that end with escaped identifiers. For example, I think 
>>>> the following would be legal Verilog under this proposal
>>>>
>>>>    `define MAC(ignored) \!@#
>>>>    wire `MAC(ignored)%^&* = 1'b1;
>>>>    wire w = \!@#%^&* ;
>>>>
>>>> -------------------------
>>>>
>>>> -- Brad
>>>>
>>>> --
>>>> This message has been scanned for viruses and dangerous content by 
>>>> MailScanner, and is believed to be clean.
>>>>
>>>>       
>>> ---------------------------------------------------------------------
>>> 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.
>>>
>>>     
>> ---------------------------------------------------------------------
>> 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* <http://www.mailscanner.info/>*, and is
> believed to be clean.
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean. *

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Dec 6 12:36:57 2007

This archive was generated by hypermail 2.1.8 : Thu Dec 06 2007 - 12:37:12 PST