Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Should p4-hlir allow arithmetic expressions in instance_count and size expressions? #21

Open
jafingerhut opened this issue Nov 22, 2016 · 0 comments

Comments

@jafingerhut
Copy link

When trying the mtag-edge.p4 example program from the p4 v1.0.2 and v1.1 specs, p4-graphs and p4-1.1-graphs give error messages when attempting to parse arithmetic operators as part of an expression for instance_count and size expressions. For example, this table definition:

table egress_meter {
    reads {
        standard_metadata.ingress_port : exact;
        mtag.up1 : exact;
    }
    actions {
        meter_pkt;
        _no_op;
    }
    size : PORT_COUNT * PORT_COUNT; // Could be smaller
}

causes the following error messages when you attempt to parse it with p4-graphs / p4-1.1-graphs:

parse error in file /home/andy/p4/andy-tests/mtag-v1.0.2/mtag-edge.p4 at line 188 : Syntax error while parsing at token * (TIMES)
parse error in file /home/andy/p4/andy-tests/mtag-v1.0.2/mtag-edge.p4 at line 188 : Invalid size attribute for table

It is straightforward to work around by replacing the expression with the result, but it would be nicer if the parser could handle this, since it seems to be allowed by the BNF in the spec.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant