ISSUE 583

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 583
Category errata
Synopsis comment_text allows \n and */
State open
Class errata-discuss
Arrival-DateMay 11 2004
Originator Shalom Bresticker <Shalom.Bresticker@freescale.com>
Release 2001b
Description
Geoffrey.Coram@analog.com wrote me the following:

I'm working in the Verilog-AMS committee and I noticed a
small glitch in the LRM definition for comments. Both
the AMS LRM and 1364-2004-d2 contain the following:

one_line_comment ::= // comment_text \n
block_comment ::= /* comment_text */
comment_text ::= { Any_ASCII_character }

However, a newline should be excluded from one_line_comment.

It's not clear what the termination is.

// this should not
match the syntax

but "this should not \n match the syntax" is comment_text
because I can use it in between /* and */

Maybe I'm thinking too much like a "greedy" parser.

A greedy parser is one that tries to fit as many tokens
into the pattern as possible.

Thus, if I had a pattern like "a*a" where * was to match
any ascii character, then from the following input stream
afooabarafoofoo
the parser would match the pattern
afooabara
and leave "foofoo" on the stack to look for the next pattern.

For the case of the comments, we want the \n (or the */) to
terminate the pattern.

A non-greedy parser would pick out "afooa" from the stream
to match the pattern and pass that as a token, and then
pick from from "barafoofoo" to find the next pattern.

-Geoffrey

Similarly, comment_text allows for */ to appear in it.

Strictly speaking, there probably should be two different
types of comment text.

Shalom

--
Shalom Bresticker Shalom.Bresticker @freescale.com
Design & Reuse Methodology Tel: +972 9 9522268
Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478

[ ]Freescale Internal Use Only
[ ]Freescale Confidential Proprietary

Fix

Unknown
Audit-Trail
From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@freescale.com
Cc:
Subject: Re: errata/583: comment_text allows \n and */
Date: Tue, 11 May 2004 15:14:01 -0400 (EDT)

Is anybody really going to have trouble understanding what is meant?
I think we have enough real issues to deal with, without nitpicking.

Steven Sharp
sharp@cadence.com

From: Michael McNamara <mac@verisity.com>
To: Shalom Bresticker <Shalom.Bresticker@freescale.com>
Cc: etf-bugs@boyd.com
Subject: RE: errata/583: comment_text allows \n and */
Date: Tue, 11 May 2004 13:14:02 -0700

Good points.

Something else to consider is an enhancement that allows non-ascii
characters in comments. (Japanese, Chinese, French, German, Hebrew, et
cetera)

-- On May 11 2004 at 02:50, Shalom Bresticker sent a message:
> To: etf-bugs@boyd.com
> Subject: "errata/583: comment_text allows \n and */"
> >Number: 583
> >Category: errata
> >Originator: Shalom Bresticker <Shalom.Bresticker@freescale.com>
> >Description:
>
> Geoffrey.Coram@analog.com wrote me the following:
>
> I'm working in the Verilog-AMS committee and I noticed a
> small glitch in the LRM definition for comments. Both
> the AMS LRM and 1364-2004-d2 contain the following:
>
> one_line_comment ::= // comment_text \n
> block_comment ::= /* comment_text */
> comment_text ::= { Any_ASCII_character }
>
> However, a newline should be excluded from one_line_comment.
>
> It's not clear what the termination is.
>
> // this should not
> match the syntax
>
> but "this should not \n match the syntax" is comment_text
> because I can use it in between /* and */
>
> Maybe I'm thinking too much like a "greedy" parser.
>
> A greedy parser is one that tries to fit as many tokens
> into the pattern as possible.
>
> Thus, if I had a pattern like "a*a" where * was to match
> any ascii character, then from the following input stream
> afooabarafoofoo
> the parser would match the pattern
> afooabara
> and leave "foofoo" on the stack to look for the next pattern.
>
> For the case of the comments, we want the \n (or the */) to
> terminate the pattern.
>
> A non-greedy parser would pick out "afooa" from the stream
> to match the pattern and pass that as a token, and then
> pick from from "barafoofoo" to find the next pattern.
>
> -Geoffrey
>
> Similarly, comment_text allows for */ to appear in it.
>
> Strictly speaking, there probably should be two different
> types of comment text.
>
> Shalom
>
> --
> Shalom Bresticker Shalom.Bresticker @freescale.com
> Design & Reuse Methodology Tel: +972 9 9522268
> Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
> POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478
>
> [ ]Freescale Internal Use Only
> [ ]Freescale Confidential Proprietary

Unformatted



Hosted by Boyd Technology