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

PEG Parser? #862

Open
adsharma opened this issue Jan 24, 2025 · 0 comments
Open

PEG Parser? #862

adsharma opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@adsharma
Copy link

I noticed that coconut uses a recursive descent parser. Circa 2020, python switched to using a PEG grammar as explained in PEP-617. Does coconut have any plans to switch?

Context: I'm looking to add a rust-compatible pattern matching syntax to a minimally modified python PEG grammar. Would like to keep it compatible with what coconut does. Details here.

Would love to understand more about:

  • Are there places where coconut pattern matching implementation differs from Rust? (Or proposed C++ pattern matching)
  • Any suggestions on how to work around the ambiguity in expression syntax when pattern matching is added. I can solve it by adding a delimiter, but I'd like to avoid doing that.

One other way to solve the ambiguity/complexity is limiting the accepted python grammar to a much smaller subset, while staying as compatible with CPython as possible.

The end goal of this is to make py2many transpiler a faster, AI assisted alternative to Rust programmers.

@evhub evhub added the question label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants