Caution
This repository is not maintained — see bufbuild/cel-es for a supported implementation of a parser and evaluator.
cel-parser is a parser for the Common Expression Language (CEL).
It's generated with Peggy, using the peggy-ts plugin. It parses a CEL expression
into a Protobuf-based abstract syntax tree. It does not evaluate expressions.
It is 100% TypeScript, passing strict checks (without any any-typing or as-casting) and it
has no runtime dependencies.
It includes a test suite derived from the cel-spec conformance tests tests.
However, because these tests are also for evaluation, the derived tests use the AST produced by the
cel-go parser as the expected output. This extraction can be re-run by with
npm run extract-conformance-tests but does require an environment with go.
It is currently passing all of the 1,916 derived conformance tests and most of cel-go's parser
tests.
To generate the parser after cloning the repo, simply run npm ci. To compile to JavaScript
bundles, use npm run bundle. After bundling, you can experiment with the parser using demo.html.
A live, in-browser parser demo is also available.