[P4-design] Diagram of where P4_16 language constructs can be used

Mihai Budiu mbudiu at vmware.com
Wed Apr 5 17:53:21 EDT 2017

It may be worthwhile to write a script to generate all these negative test cases and then to save them as negative tests for the compiler.

Since many of these programs may have a lot of boilerplate in common maybe we can just have a common #include file for the boilerplate.


From: P4-design [mailto:p4-design-bounces at lists.p4.org] On Behalf Of Andy Fingerhut (jafinger)
Sent: Wednesday, April 5, 2017 9:15 AM
To: p4-design at lists.p4.org
Subject: Re: [P4-design] Diagram of where P4_16 language constructs can be used

I still don’t have package instantiations mentioned anywhere, nor extern function calls, but I think everything else is there now.

I also have a text file version, which is a little more compact and easier to open in an editor:


I also happen to have a horribly ugly P4 program that exercises all of the allowed things at least once, plus hundreds of lines of commented-out things that cause the compiler to give errors.  The positive test case for supported things I can see as being useful, but the number of individual negative test cases here really is quite a lot, and I’d think if one wanted such things for the compiler, it is probably easier to auto-generate them with a program from some kind of template.


From: P4-design <p4-design-bounces at lists.p4.org<mailto:p4-design-bounces at lists.p4.org>> on behalf of "Andy Fingerhut (jafinger)" <jafinger at cisco.com<mailto:jafinger at cisco.com>>
Date: Sunday, April 2, 2017 at 1:52 PM
To: "p4-design at lists.p4.org<mailto:p4-design at lists.p4.org>" <p4-design at lists.p4.org<mailto:p4-design at lists.p4.org>>
Subject: [P4-design] Diagram of where P4_16 language constructs can be used

It isn’t complete, e.g. I haven’t included where parser/control/extern instantiations and method calls can go, and it doesn’t mention enum, tuple, and a few other type definitions, but it does meet my original goal of showing where most of the language constructs can be used in a P4_16 program relative to each other.


GraphViz dot input file used to generate the figures here:



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-design_lists.p4.org/attachments/20170405/30d87da7/attachment-0002.html>

More information about the P4-design mailing list