BTF - BE35 - ambiguous grammar for number

From: Anders Nordstrom (andersn@bcarsb82)
Date: Fri Aug 22 1997 - 08:54:57 PDT


Subject: BTF - BE35 - ambiguous grammar for number

Behavioral Task Force - Errata Submission

Assigned Enhancement Request Number: BE35
Errata Name (Description): ambiguous grammar for number
Section: 2.5.1
Date Submitted: 970701
Requestor: Paul Graham

Status: Submitted (priority not yet assigned)

Errors found in the Verilog LRM (IEEE 1364-1995).

Details:
        The grammar for a number is ambiguous. A number, for instance a
real_number, may begin with a sign (+ or -). Yet the syntax for expression
allows + and - to be unary operators. So the expression -3 can be parsed
either as a decimal_number with a sign or as an expression whose operator is
- and whose operand is the (positive) decimal_number 3.

If -3 is parsed as a decimal_number with a sign, then the statement:

    parameter x = --3;

hould be legal, since the first "-" is a unary operator in an expression
and the second is not an operator at all, but part of the decimal_number.

I recommend that you follow VHDL's rule which is that a numeric literal
never includes a sign, and any sign (+ or -) preceding a numeric literal is
a unary operator in an expression.

+-----------------------------------------------------------------------+
| Anders Nordstrom |
| Senior ASIC Designer |
| Northern Telecom Ltd. Email: andersn@nortel.ca |
| P.O. Box 3511 Station C Phone: 613-763-9186 |
| Ottawa, Ontario K1Y 4H7 Fax: 613-763-2626 |
+-----------------------------------------------------------------------+



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:41 PDT and
sponsored by Boyd Technology, Inc.