one more problem with the BNF - signed function declarations


Subject: one more problem with the BNF - signed function declarations
From: Jacobi, Dan (dan.jacobi@intel.com)
Date: Mon Jan 06 2003 - 06:02:23 PST


According the current BNF I think that the signing of the function
declaration is not current.
quoting the BNF :

under A.2.6 (pg. 97)
        function_declaration ::=
                function [ automatic ] [ signing ] [ range_or_type ]
                  [ interface_identifier . ] function_identifier ;
                  { function_item_declaration }
                  { function_statement }
                  endfunction [ : function_identifier ]
                | function [ automatic ] [ signing ] [ range_or_type ]
                  [ interface_identifier . ] function_identifier (
function_port_list ) ;
                  { block_item_declaration }
                  { function_statement }
                  endfunction [ : function_identifier ]

        range_or_type ::=
                { packed_dimension } range
                | data_type
        
under A.2.2.1
        data_type ::=
                integer_vector_type [ signing ] { packed_dimension } [ range
]
                | integer_atom_type [ signing ] { packed_dimension }
                | type_declaration_identifier
                | non_integer_type
                | struct [ packed ] [ signing ] { { struct_union_member } }
                | union [ packed ] [ signing ] { { struct_union_member } }
                | enum [ integer_type [ signing ] { packed_dimension } ]
                  { enum_identifier [ = constant_expression ] { ,
enum_identifier [ = constant_expression ] } }
                | void

        signing ::= signed | unsigned (changed on the 11/11/02)

This BNF accepts the following function declarations:
function signed void foo1(...); // can a void function be
signed ?
function signed bit unsigned foo2(...); // is the function signed or not ?

I'm not sure what is the proper way to declare a function that returns a
signed integer/enum/struct/union/user_defined value :
        a. function signed logic foo3(...);
                or
        b. function logic signed foo3(...);

if the declaration b. is correct
then the following changes to A.2.6 should solve the problem :
        function_declaration ::=
                function [ automatic ] [ range_or_type_or_signing ] [
range_or_type ]
                  [ interface_identifier . ] function_identifier ;
                  { function_item_declaration }
                  { function_statement }
                  endfunction [ : function_identifier ]
                | function [ automatic ] [ range_or_type_or_signing ] [
range_or_type ]
                  [ interface_identifier . ] function_identifier (
function_port_list ) ;
                  { block_item_declaration }
                  { function_statement }
                  endfunction [ : function_identifier ]

        range_or_type_or_signing ::=
                signing
                | [signing] { packed_dimension } range
                | data_type

        remove the range_or_type syntactic category

Thanks

Dan Jacobi
Intel Corp.



This archive was generated by hypermail 2b28 : Mon Jan 06 2003 - 06:03:20 PST