-
Notifications
You must be signed in to change notification settings - Fork 226
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
feat: Initial Lezer grammar #1289
Conversation
Based on #1102 I've been using https://lezer-playground.vercel.app/, which is great! And I struggled to set up a JS project that was good for iterating; though we'll need to do that at some point. This parses our standard query (in examples.md) though it gives a couple of warnings around linebreaks — I still haven't really got my head around the way `@precedence` works. It doesn't yet parse things like `func` & `table` though those aren't difficult. It heavily relied upon our pest file, though requires some different approaches in some areas. --- Where should this go? In this repo? How should we package it? https://github.com/Snowflake-Labs/lezer-snowsql is an example of a full repo & package for a Lezer grammar
for more information, see https://pre-commit.ci
I like the syntax of Lezer grammars, because it's quite similar to EBNF #285. But I don't see the point of having another grammar definition, along with 4 others, each of which is not totally correct... We need a way to unify them somehow. |
In a way I couldn't agree more — I've been quite surprised at how fragmented the space is. But what's the alternative? They're too different to automatically translate — at least no one has built a tool to do that. And we need CodeMirror / Lezer for PRQL to a) be included in DuckDB's new tool (though we have no guarantee it would be included even if we do make this), and b) have syntax highlighting in Jupyter (though again, it's still non-trivial to get that to work). But totally mood-affiliated and very open to ideas! (And maybe someone will come and ask for a treesitter grammar — that would be a 5th!) |
Ok, that all I needed to hear: there is a need for them. The grammar should not change much so there is not a lot of maintenance anyway. And even it they are broken, the worst effect is bad syntax highlighting. |
This is in a pretty good state now! I now need to work out how to get it to work with Jupyter etc; it may go in its own repo. I may use https://github.com/Snowflake-Labs/lezer-snowsql as a template |
Done! This contributes towards (but doesn't close) PRQL/pyprql#45 |
* feat: Initial Lezer grammar Based on PRQL#1102 I've been using https://lezer-playground.vercel.app/, which is great! And I struggled to set up a JS project that was good for iterating; though we'll need to do that at some point. This parses our standard query (in examples.md) though it gives a couple of warnings around linebreaks — I still haven't really got my head around the way `@precedence` works. It doesn't yet parse things like `func` & `table` though those aren't difficult. It heavily relied upon our pest file, though requires some different approaches in some areas. --- Where should this go? In this repo? How should we package it? https://github.com/Snowflake-Labs/lezer-snowsql is an example of a full repo & package for a Lezer grammar * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * . * . * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * . Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Based on #1102
I've been using https://lezer-playground.vercel.app/, which is great! And I struggled to set up a JS project that was good for iterating; though we'll need to do that at some point.
This parses our standard query (in examples.md) though it gives a couple of warnings around linebreaks — I still haven't really got my head around the way
@precedence
works.It doesn't yet parse things like
func
&table
though those aren't difficult. It heavily relied upon our pest file, though requires some different approaches in some areas.Where should this go? In this repo? How should we package it? https://github.com/Snowflake-Labs/lezer-snowsql is an example of a full repo & package for a Lezer grammar