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

From: Paul Graham <pgraham@cadence.com>
Date: Tue Aug 31 2004 - 08:15:10 PDT

> The identification of a comment depends on the tokenization of the
> preceding program text.

There is a similar potential ambiguity in C:

    int x, y, *z;
    x = y/*z;

Is the "/*" the start of a comment, or a division by a pointer
dereference?

In C, the question was resolved by an appeal to authority. A C compiler
should do whatever the original C compiler did. The original C compiler
had a separate cpp pass, which of course would pick the /* out as a
comment delimiter. A C compiler with a combined lexer/cpp module must
do whatever is necessary to match the cpp behavior.

Likewise, I think that a verilog lexer should do whatever verilog-xl
does for:

    case x://

Whether the lexer has a separate pass for comment scanning, or does
everything in one pass, the results (for the standard verilog subset)
should match what verilog-xl does.

Paul
Received on Tue Aug 31 08:15:13 2004

This archive was generated by hypermail 2.1.8 : Tue Aug 31 2004 - 08:15:17 PDT