Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization and Deserialization for parser Expression #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JonasHedEng
Copy link
Contributor

I'd like to be able to store a successfully parsed CEL expression by de-/serializing it externally. To be able to use it again, I added the Program::from(Expression).

I tried to check whether there are any issues with serde on the Arc-ed types but didn't find why LALRPOP does the wraps. I assume it's a combination of simplifying lifetimes and that it's needed for (potentially) larger ASTs to avoid copying. In the case of most uses of CEL I would expect serialization to be the overhead either way. Maybe it's possible to put a disclaimer in some good place noting that serializing and deserializing potentially could use up much more memory than before the serialization? Either way, it shouldn't have any semantic impact, right?

@clarkmcc
Copy link
Owner

clarkmcc commented Nov 14, 2024

Sounds similar to #80 except that this approach would not allow for portability between the Go and Rust interpreters for example. I'm not opposed to this though as a stop-gap measure when cross-interpreter portability is not required.

Can you write some tests doing the serialization both ways?

@JonasHedEng
Copy link
Contributor Author

Cool! Yeah, I was planning to take a stab at implementing #80 if/when I get some time over. I'll look into adding some tests soon

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.

2 participants