evhub / evhub/coconut

PEG Parser?

Open
#862 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
4.4k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

I noticed that coconut uses a recursive descent parser. Circa 2020, python switched to using a PEG grammar as explained in [PEP-617](https://peps.python.org/pep-0617/). 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](https://github.com/we-like-parsers/pegen/issues/107).

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.