Skip to content

Lark text parser #319

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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Lark text parser #319

wants to merge 15 commits into from

Conversation

weinbe58
Copy link
Member

This PR is a PR to address #199 The overall idea is to use a trait to generate the grammer for statements and leave the overall parsing rules for Region and Block hardcoded into the grammer along with some other rules regarding things like ssa identifiers block identifiers comments, etc. The grammer is collected from a dialect group merging all the rules together coming from the traits of individual statements and attributes inside the dialect group and compiled into a Lark Grammer. The rules form a registry, making an individual rule to an IR node.

The final grammar is then used to parse a string given an entry point statement: func. Function, Module, etc. After that, the Lark tree will be visited and lowered using the Lowering framework to generate the IR. The registry of lark rules is used by the lowering infrastructure to dispatch the lark tree labels to the specific statements and attributes.

@weinbe58 weinbe58 marked this pull request as draft March 13, 2025 18:34
Copy link
Contributor

PR Preview Action v1.6.0

🚀 View preview at
https://QuEraComputing.github.io/kirin/pr-preview/pr-319/

Built to branch gh-pages at 2025-03-13 18:36 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

1 participant