[P4-dev] Slight Problem with a Boolean Expression

Peter Newman petenewm at cisco.com
Thu Aug 13 14:59:03 EDT 2015


Antonin,

Thanks. I guess it is time to update my tool set.

At the risk of sharing my ignorance with the entire community I also get 
the following compiler error:

ERROR: Table 'layer2_forwarding' is invoked multiple times.

The spec specifically states that I can invoke the same table multiple 
times as long as it is the same identical table. Is this another old 
compiler version problem? I'm invoking the compiler with the command: 
'p4-validate'.

--Peter

On 8/13/2015 11:43 AM, Antonin Bas wrote:
> Hi Peter,
>
> Thanks for reporting this bug, I just fixed it (some missing rule in 
> the parser code). The relevant commit is this one: 
> https://github.com/p4lang/p4-hlir/commit/3d6b69511b32daebdc5eb980dec8b56fbefea455
>
> Feel free to just pick up this commit, although I recommend pulling 
> the latest code if you are using an old version. We have made a bunch 
> of fixes since last April.
>
> Also, don't hesitate to report bugs like this directly in Github.
>
> Thanks again,
>
> Antonin
>
> On Thu, Aug 13, 2015 at 11:20 AM, Peter Newman <petenewm at cisco.com 
> <mailto:petenewm at cisco.com>> wrote:
>
>     Antonin,
>
>     I'm trying to express a test for a multicast IPv4 address:
>
>     if ((ipv4.dstAddr & 0xf0000000) == 0xe0000000) {
>         /* do something with multicast pkt */
>     }
>
>     I receive the following error from the compiler:
>
>     parse error in file xxx.p4 at line 144 : Syntax error while
>     parsing at token ) (RPAREN)
>     parse error in file xxx.p4 at line 144 : Invalid boolean expression
>     2 errors during parsing
>
>     If I remove the parenthesis the compiler accepts the expression
>     but the operator precedence would be incorrect.
>
>     I am using the original public version of the compiler (so my
>     apologies if this has already been fixed).
>
>     According to the BNF in the spec (version 1.0.2) I believe this to
>     be a valid expression (other than the requirement to use \& for
>     bitwise AND which I take to be a typo).
>
>     --Peter
>
>
>
>
> -- 
> Antonin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150813/c3be50be/attachment-0001.html>


More information about the P4-dev mailing list