[P4-dev] expecting ACTION or CONST or TABLE

Han Wang hanwang at barefootnetworks.com
Thu Oct 5 14:40:32 EDT 2017


This works for me.

#include <core.p4>
control foo() {
    action a(in bit<8> x) {}
    table t {
        actions = {
            a(8w5); // binding a's parameter x to 5
        }
    }
    apply{}
}

Compiled with
p4test --p4-14 bug-steve-king.p4

> On Oct 5, 2017, at 11:30 AM, King, Steven R <steven.r.king at intel.com> wrote:
> 
> Hello P4,
> 
> I'm trying and failing to construct a minimal error-free example of a table in a control block.
> 
> AFAICT from the p4-16 spec, this code is valid:
> 
>    $ cat dummy.p4
>    control foo() {
>        action a(inout bit<8> x) {}
>        table t {
>            actions = {
>                a(5); // binding a's parameter x to 5
>            }
>        }
>    }
> 
> 
> Building this code returns the following error:
>    $ p4c -c dummy.p4
>    dummy.p4(8):syntax error, unexpected }, expecting ACTION or CONST or TABLE
>    }
>    ^
>    error: 1 errors encountered, aborting compilation
> 
> 
> Can someone please show the fix needed to make this code compile?
> 
> Thanks,
> -steve
> 
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org





More information about the P4-dev mailing list