p4c is a reference compiler for the P4 programming language. It supports both P4-14 and P4-16; you can find more information about P4 in our carefully curated Documentation.
- Warning
P4 Compiler's Documentation is a work in progress i.e. 🔨&🚀. This version contains mostly temporary placeholder functionality.
Overview
The P4C compiler is a compiler infrastructure for the P4 compiler designed with the following goals:
- Support current and future versions of P4
- Support multiple back-ends
- Generate code for ASICs, NICs, FPGAs, software switches and other targets
- Provide support for other tools (debuggers, IDEs, control-plane, etc.)
- Open-source front-end
- Extensible architecture (easy to add new passes and optimizations)
- Use modern compiler techniques (immutable IR, visitor patterns, strong type checking, etc.)
- Comprehensive testing
Additional documentation
- the P4_14 (P4 v1.0) language is described in the P4 spec
- the P4_16 draft language specification is still under revision.
- the core design of the compiler intermediate representation (IR) and the visitor patterns are briefly described in IR
- The migration guide describes how P4_14 (v1.0) programs are translated into P4_16 programs