Re: Fwd: BNF question

From: Brad Pierce (Brad.Pierce@synopsys.com)
Date: Fri Oct 11 2002 - 19:29:31 PDT

  • Next message: Shalom.Bresticker@motorola.com: "errata/159: footnote numbering in syntax boxes"

    Precedence: bulk

    One approach to yaccing list_of_port_declarations
    is to keep in mind that none of its commas are
    delimiters, instead --

        All the commas are just syntactic sugar.

    For example, the following list is unambiguous --

       ( input A B C input[3:0] Z1 Z2 Z3 output D E F )

    The delimiters are the parens and keywords.
    The commas are just mandatory comments.

    So it may be easier to think of parsing these as if
    the grammar were without commas, and then to add extra
    productions that allow commas to be scattered about.
    Excluding the illegal comma scatterings can be done
    by the embedded actions instead of by the grammar
    itself.

    -- Brad

    -----Original Message-----
    From: owner-etf@boyd.com [mailto:owner-etf@boyd.com]On Behalf Of Jayaram
    Bhasker
    Sent: Friday, October 11, 2002 6:14 AM
    To: 'Shalom Bresticker'; Stuart Sutherland; jcampbell@provis.com
    Cc: etf@boyd.com
    Subject: RE: Fwd: BNF question

    Shalom:

    No, this is not ANSI C style. I believe I had also objected to the current
    syntax earlier
    this year, my suggestion was either to follow the ANSI C style or to
    to introduce a ';' after each port declaration. But an argument was made
    that "smart"
    tools would have no problem in parsing:

    input A, B, C, input[3:0] Z1, Z2, Z3, output D, E, F

    and that all the extra "input" "output" (if you were to use ANSI style) are
    redundant.

    I guess yacc is not a "smart" tool.

    - bhasker

    -----Original Message-----
    From: Shalom Bresticker [mailto:Shalom.Bresticker@motorola.com]
    Sent: Thursday, October 10, 2002 3:52 AM
    To: Stuart Sutherland; jcampbell@provis.com
    Cc: etf@boyd.com
    Subject: Re: Fwd: BNF question

    Regarding the error, I think Jason is correct.
    10.3.1 says,
    "The second method shall have the name of the function, followed by an open
    parenthesis, and one or more input declarations, separated by commas. After
    all the input declarations, there shall be a close parenthesis, and a
    semicolon. After the semicolon, there shall be zero or more block item
    declarations, followed by a behavioral statement, and then the endfunction
    keyword. "
    I guess the fix is to delete the first block_item_declaration and just leave
    { block_item_declaration }.

    Regarding the port list grammar, although I was not involved in it,
    my understanding is that ANSI C works that way, and ANSI C was
    the model.
    Shalom

    >From: "Jason Campbell" <jcampbell@provis.com>
    > > I was wondering if there has been an update to the BNF since
    > > 1364-2001 was published? I think there is an error in the
    > > function BNF as follows:
    > >
    > > function [ automatic ] [ signed ] [ range_or_type ]
    > > function_identifier ( function_port_list } ;
    > > block_item_declaration { block_item_declaration }
    > > function_statement
    > > endfunction
    > >
    > > I believe the block_item_declaration is optional not required.
    > > The example in the specification on page 158 results in a syntax
    > > error with the BNF as in the specification because it doesn't
    > > contain a object in the block_item_declaration rule.
    > >
    > > Also, who came up with the grammer for the port list? This is
    > > really hard to do in yacc. It's difficult to tell the difference
    > > between a list_of_port_identifiers and a tf_input_declaration
    > > because they are both delimited by ','. For example,
    > >
    > > function f(input a, b);
    > > vs
    > > function f(input a, input b);
    > >
    > > It would have been far easier if a ';' had been used after each
    > > list_of_port_identifiers. For example,
    > >
    > > function f(input a; input b);

    --
    Shalom Bresticker                           Shalom.Bresticker@motorola.com
    Design & Reuse Methodology                             Tel: +972 9 9522268
    Motorola Semiconductor Israel, Ltd.                    Fax: +972 9 9522890
    POB 2208, Herzlia 46120, ISRAEL                       Cell: +972 50 441478
    

    "The devil is in the details."



    This archive was generated by hypermail 2.1.4 : Fri Oct 11 2002 - 19:30:35 PDT and
    sponsored by Boyd Technology, Inc.