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

Expose parsing for consumers #3

Open
mainrs opened this issue Mar 2, 2023 · 2 comments
Open

Expose parsing for consumers #3

mainrs opened this issue Mar 2, 2023 · 2 comments

Comments

@mainrs
Copy link

mainrs commented Mar 2, 2023

Hello!

I am looking into writing a sieve filter linter and formatter. I have started work on my own parser and found your crate afterwards.

Is it possible to leverage your already existing parsing capabilities and work on some kind of ast?

That way I would not have to write my own parser. If that is out of scope for this project, let me know and I'll happily link my crate for others to find!

@mdecimus
Copy link
Member

mdecimus commented Mar 2, 2023

Hi,

That would be a nice addition but unfortunately, since I am currently busy working on the mail server, I don't think I'll have time to implement this anytime soon.

Currently when a script is compiled with this crate, an abstract representation is returned but not as an AST but rather an array with instructions where any nested code in the script is unrolled. Since grammar validation is done directly within the compiler I do not think it can be easily exposed. That being said, it might save you some work to use the tokenizer directly, this way you'll only have to implement the grammar validation in your crate.

xtuc added a commit to xtuc/sieve that referenced this issue Apr 26, 2024
@xtuc
Copy link

xtuc commented Apr 26, 2024

What do you think about #7? This makes it possible for projects to consume the Sieve parser.

xtuc added a commit to xtuc/sieve that referenced this issue Apr 26, 2024
xtuc added a commit to xtuc/sieve that referenced this issue Apr 27, 2024
xtuc added a commit to xtuc/sieve that referenced this issue Apr 27, 2024
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

No branches or pull requests

3 participants