Skip to content

PEG Parser? #862

@adsharma

Description

@adsharma

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions