[P4-dev] Slight Problem with a Boolean Expression

Antonin Bas antonin at barefootnetworks.com
Thu Aug 13 14:43:37 EDT 2015


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> 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/a6851f15/attachment-0001.html>


More information about the P4-dev mailing list