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

Use ANTLR grammar for PartiQL diagnostics #383

Merged
merged 8 commits into from
Jul 22, 2024
Merged

Conversation

akoreman
Copy link
Contributor

@akoreman akoreman commented Jul 16, 2024

Problem

The parser used by the PartiQL server currently doesn't support DDL/DML statements (see partiql/partiql-lang-rust#472). This results in diagnostics being returned by the server even for valid syntax blocking the server from being used effectively.

Solution

This temporarily changes the validation used by the server to be based on the ANTLR grammar defined for the PartiQL language (defined here) using the antlr4ng target for the ANTLR parser. Added to the repo are the .g4 grammar files and the parser/lexers from those are automatically generated. Ideally, we wouldn't commit the src/antlr-generated folder and just generate those in a precompile hook but the generation of the parser/lexer files requires Java to be installed on the system which would impose that constraint on anyone who wants to work with this repository.

The, currently unused, files for the Rust Wasm PartiQL parser are left in the repository. When the server is actually used, the bundler will shake out those files to not add them to the bundle size.

Added tests for the new parser.

Screenshot 2024-07-16 at 22 43 31

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@akoreman akoreman requested review from a team as code owners July 16, 2024 20:44
@akoreman akoreman marked this pull request as draft July 16, 2024 20:51
@akoreman akoreman marked this pull request as ready for review July 18, 2024 22:12
@akoreman akoreman merged commit 59e654a into aws:main Jul 22, 2024
5 checks passed
@akoreman akoreman deleted the partiql_antlr branch July 22, 2024 14:16
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.

2 participants