p4lang/p4-hlir

Parsing of Meter does not reflect the specification ver 1.0.2

Opened this issue · 0 comments

Dear all,

according to the specification, section 7.2. Meters, you have the following BNF for a meter

meter_declaration ::=
meter meter_name {
type : meter_type ;
result : field_ref ;
[ direct_or_static ; ]
[ instance_count : const_value ; ]
}

but then you swap 'result' and 'direct_or_static' order into the parser rule at line 1218 of parser.py

def p_meter_declaration(self, p):
    """ meter_declaration : METER ID LBRACE \
                                TYPE COLON meter_type SEMI \
                                direct_or_static \
                                direct_result \
                                instance_count \
                            RBRACE

I think this probably is a typo, so I've issued a pull request to fix the order.