p4c is a reference compiler for the P4 programming language.
p4c is modular; it provides a standard frontend and midend which can be combined with a target-specific backend to create a complete P4 compiler. The goal is to make adding new backends easy. The code contains five sample backends:
simple_switch
written using the BMv2 behavioral model,One fact attesting to the level of quality and completeness of p4c’s code is that its front-end code, mid-end code, and p4c-graphs back end are used as the basis for at least one commercially supported P4 compiler.
For more information, visit the p4c repository.