CEL Specification#
This page summarizes the canonical CEL specification. Refer to the official specification for authoritative details.
Grammar#
CEL expressions follow this grammar. Operator precedence is encoded in the production hierarchy, from lowest (conditional) to highest (primary).
Notation#
The grammar uses Extended Backus-Naur Form (EBNF):
| Notation | Meaning |
|---|---|
= |
Definition |
| |
Alternation |
[] |
Optional (zero or one) |
{} |
Repetition (zero or more) |
() |
Grouping |
"x" |
Terminal string |
UPPER |
Terminal (token) |
Lower |
Non-terminal (production) |
Expressions#
An expression is a conditional, which may include a ternary operator.
Logical operators#
Logical OR has lower precedence than logical AND.
ConditionalOr = ConditionalAnd { "||" ConditionalAnd } ;
ConditionalAnd = Relation { "&&" Relation } ;
Relational operators#
Comparison and membership operators.
Arithmetic operators#
Addition and subtraction have lower precedence than multiplication.
Addition = Multiplication { ( "+" | "-" ) Multiplication } ;
Multiplication = Unary { ( "*" | "/" | "%" ) Unary } ;
Negation#
Negation and logical NOT.
Member access#
Field access, indexing, and method calls.
Primary expressions#
Literals, identifiers, parenthesized expressions, and constructors.