RE: [sv-ac] Mantis 1901 grammar of cycle_delay/cycle_delay_range

From: Korchemny, Dmitry <dmitry.korchemny@intel.com>
Date: Mon Feb 22 2010 - 07:06:04 PST

Hi Wilson,

You are welcome to open a mantis documenting your concern. Note, that the language BNF in the LRM is provided for definition only, and it is not aimed to be an implementation grammar. Some checks are done semantically, and not syntactically. This, of course, does not mean that the problem should not be addressed.

Regards,
Dmitry

-----Original Message-----
From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Wilson Snyder
Sent: Monday, February 15, 2010 3:45 PM
To: sv-ac@eda.org
Subject: [sv-ac] Mantis 1901 grammar of cycle_delay/cycle_delay_range

I am confused by a change made to the 1800-2009 spec for
cycle_delay_range originally proposed in Mantis 1901. The
change allowed for a constant_primary following "##".
However, this was NOT done for cycle_delay_range. I believe
they should be consistent.

Futhermore, the change makes it far more difficult to parse
the language, in a way that doesn't occur in any other
grammar places in the language. (Below)

For these reasons, I would prefer if this change was backed
out and the () was always required as in 1800-2005, as this
makes the grammar far, far easier to implement - but suspect
it's too late ;)

Thanks.

Both 1800-2009 and 1800-2005:

  cycle_delay ::=
        '##' integral_number
        | '##' identifier
        | '##' '(' expression ')'

1800-2005:

  cycle_delay_range ::=
        '##' integral_number
        | '##' identifier
        | '##' '(' constant_expression ')'
        | '##' '[' cycle_delay_const_range_expression ']'

1800-2009:

  cycle_delay_range ::=
        '##' constant_primary
        | '##' '[' cycle_delay_const_range_expression ']'
        | '##[*]'
        | '##[+]'

The problem is

  sequence_expr ::=
        cycle_delay_range sequence_expr { cycle_delay_range sequence_expr }
        ...

  expands to
        '##' constant_primary sequence_expr
        ...

This is the only place in the entire language grammar where
a primary is next to an expression without a operator or
other token in between; this makes a mess, for example
constant_primary includes constant_function_call which
eventually includes

        system_tf_identifier [ '(' list_of_arguments ')' ]

where list_of_arguments can be empty

so we have

        '##' system_tf_identifier [ '(' [expr] ')' ] sequence_expr

and sequence_expr can contain a parenthesized expression
also, so we have a conflict - does the parenthesis belong to
the sequence or the identifier?

Having "primary(_constant) (sequence_)expr" adjacent makes
it impossible to parse as LALR - without top-down parsing
and retry; an implementation restriction not currently in
the language. (Or at least, I did 1800-2005 and am almost
done all of 1800-2009 except this, without it.)

Not to mention making it nearly impossible for humans to
read...

Thanks

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Feb 22 07:07:57 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 22 2010 - 07:08:08 PST