RE: [sv-bc] precedence of :/ vs. //

From: Andrew Brown <abrown@amphion.com>
Date: Mon Aug 30 2004 - 00:34:44 PDT

No problem for the user as long as the rule "I can stick a comment
ANYWHERE" is not broken. (One exception - no comments inside strings).
More a problem for lexer writers ... and I know it may not seem like a
big deal, but these things tend to get missed or miss-coded, leading to
incompatibilities in compilers - or worse - me not being able to put
comments anywhere and spending days debugging a problem related to
comments. Whatever the solution is, it should probably be explicitly
stated somewhere to ensure compatibility, so kudos to Paul for bringing
it up.

Andrew

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
> Behalf Of Kevin Cameron
> Sent: 27 August 2004 19:33
> To: Brad Pierce
> Cc: sv-bc@eda.org
> Subject: Re: [sv-bc] precedence of :/ vs. //
>
> On Fri, 27 Aug 2004, Brad Pierce wrote:
>
> > I agree that many lexers maximum munch, but in this case it would
> > yield a result that is inconsistent with the Verilog standard.
> >
> > Other examples are
> >
> > j = +++i ;
> >
> > which can only be parsed as
> >
> > j = + ++i ;
> >
> > and
> >
> > specify
> > ( A +=> Z ) = ( 0.075 , 0.950 );
> > endspecify
> >
> > Re the latter example, note that +=> is not a Verilog
> operator, hence
> > not a token, but is, according to the Verilog BNF, a combination of
> > two operators, + and =>. In practice, of course, the
> latter example
> > will work with maximum munching, because a lexer
> implementation will
> > behind the scenes treat +=> and -=> as additional tokens, and the
> > parser will have a couple extra rules behind the scenes to
> deal with
> > them. Those are implementation details, not usability problems or
> > ambiguities.
> >
> > >I meant: "://xxxx" would indeed be lexed as :/ followed
> by the lex
> > >of
> > /xxxx"
> >
> > > Many lexers indeed use a "maximum munch" principle, i.e., i.e.,
> > > continue gobbling characters as long as it legally extends the
> > > current token under consideration. By that principle,
> ://xxxx would
> > > indeed be lexed as :/ followed by a comment.
> >
> > I don't think making things slightly easier for lexer implementers
> > (such as myself) should be one of our high priorities. Is there a
> > problem for the user here?
>
> Given that implementers are a limited resource, and there are
> plenty of other things they could be working on - as a user
> I'd rather they were working on the other stuff.
>
> Kev.
>
> >
> > -- Brad
> >
> >
>
Received on Mon Aug 30 00:35:00 2004

This archive was generated by hypermail 2.1.8 : Mon Aug 30 2004 - 00:36:00 PDT