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

From: Kevin Cameron <sv-xx@grfx.com>
Date: Fri Aug 27 2004 - 11:32:31 PDT

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 Fri Aug 27 11:32:37 2004

This archive was generated by hypermail 2.1.8 : Fri Aug 27 2004 - 11:32:52 PDT