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?
-- Brad
Received on Fri Aug 27 10:27:33 2004
This archive was generated by hypermail 2.1.8 : Fri Aug 27 2004 - 10:27:35 PDT