Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Common Expression Language -- specification and binary representation

License

NotificationsYou must be signed in to change notification settings

google/cel-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

The Common Expression Language (CEL) implements common semantics for expressionevaluation, enabling different applications to more easily interoperate.

Key Applications

  • Security policy: organizations have complex infrastructure and need commontooling to reason about the system as a whole
  • Protocols: expressions are a useful data type and require interoperabilityacross programming languages and platforms.

Guiding philosophy:

  1. Keep it small & fast.
    • CEL evaluates in linear time, is mutation free, and not Turing-complete.This limitation is a feature of the language design, which allows theimplementation to evaluate orders of magnitude faster than equivalentlysandboxed JavaScript.
  2. Make it extensible.
    • CEL is designed to be embedded in applications, and allows forextensibility via its context which allows for functions and data to beprovided by the software that embeds it.
  3. Developer-friendly.
    • The language is approachable to developers. The initial spec was basedon the experience of developing Firebase Rules and usability testingmany prior iterations.
    • The library itself and accompanying toolings should be easy to adopt byteams that seek to integrate CEL into their platforms.

The required components of a system that supports CEL are:

  • The textual representation of an expression as written by a developer. It isof similar syntax to expressions in C/C++/Java/JavaScript
  • A representation of the program's abstract syntax tree (AST).
  • A compiler library that converts the textual representation to the binaryrepresentation. This can be done ahead of time (in the control plane) orjust before evaluation (in the data plane).
  • A context containing one or more typed variables, often protobuf messages.Most use-cases will useattribute_context.proto
  • An evaluator library that takes the binary format in the context andproduces a result, usually a Boolean.

For use cases which require persistence or cross-process communcation, it ishighly recommended to serialize the type-checked expression as a protocolbuffer. The CEL team will maintains canonical protocol buffers for ASTs andwill keep these versions identical and wire-compatible in perpetuity:

Example of boolean conditions and object construction:

// Conditionaccount.balance >=transaction.withdrawal|| (account.overdraftProtection&&account.overdraftLimit >=transaction.withdrawal-account.balance)// Object constructioncommon.GeoPoint{latitude:10.0,longitude:-5.5 }

For more detail, see:

Released under theApache License.

About

Common Expression Language -- specification and binary representation

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp