Skip to content

Conversation

@mcy
Copy link
Member

@mcy mcy commented Nov 18, 2025

This PR adds experimental/expr, a new AST for generic expressions, which is capable of representing (at minimum) both Protobuf and CEL expressions, along with many other potential syntaxes.

This is intended to unify our expression parsing framework; eventually, it should ideally replace the ast.Expr* types, but that is not a short-term goal for this package. For now, it will be used as a testing ground for a new stand-alone expression language.

This PR also includes an internal/exprx package which provides an expression serialization mechanism for use in tests, similar to astx.ToProto. It also includes new keywords, which do not have corresponding taxa; that will be rectified as part of the work to implement the parser.

Finally, I've added Trie.Prefixes, which allows iterating over all prefixes of a string in a trie. This is necessary in the lexer so that the keyword we select in the lexer does not wind up being the longest prefix among all keywords, not just those the lexer configuration accepts.

@mcy mcy requested a review from doriable November 19, 2025 21:44
@mcy mcy enabled auto-merge (squash) November 20, 2025 23:26
@mcy mcy merged commit 3f9009b into main Nov 20, 2025
6 checks passed
@mcy mcy deleted the mcy/expr-ast branch November 20, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants