Repository navigation
Conversation
Add grammar/OssieExpression.g4, an ANTLR 4 grammar for the expression language in core-spec/expression_language.md, with Python tests that parse valid/invalid fixtures, the expressions in examples/, and check operator precedence. Add a grammar CI workflow, a README, a label rule, an .editorconfig rule for .g4 files, and a pointer from the spec. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move the ANTLR grammar next to the spec (core-spec/grammar/) and the valid/invalid expression fixtures to compliance/expressions/ so any parser can run them. Require at least one argument after DISTINCT in function calls, and add SUM(DISTINCT) and COUNT(DISTINCT) to the invalid fixtures. Drop the stale NOT precedence note from the grammar header, update CI paths, labels and links, and ignore generated ANTLR output. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…spec/expression_language.md
|
Thank you for your first contribution to Apache Ossie (incubating)! A committer will review your PR. In the meantime, please ensure:
No ICLA is required to contribute. If you are elected as a committer in the future, you will need an Individual Contributor License Agreement (ICLA) on file with the ASF. Questions? Ask in the PR comments or join us on Slack. We appreciate your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an ANTLR 4 reference grammar for the
OSSIE_SQL_2026expression language.core-spec/grammar/OssieExpression.g4is the grammar.compliance/expressions/valid.txtandinvalid.txtare language-neutral conformance fixtures (one expression per line), so any parser can run them.core-spec/grammar/tests/has a pytest runner. It generates the Python parser, runs both fixture files, parses everyANSI_SQL/OSSIE_SQL_2026expression inexamples/*.yaml, and pins operator precedence on the parse tree..github/workflows/grammar-ci.ymlruns the tests (Python 3.11 and 3.14).core-spec/expression_language.mdgets a short pointer to the grammar at the end. The spec stays normative; where the two differ, the spec wins.Layout and approach follow JB's review.
Open points for the spec (not decided here)
||precedence: the grammar parses it at the level of+and-, soa || b + cis(a || b) + c. sqlglot and PostgreSQL parse it asa || (b + c).$.LIKE ... ESCAPEis not supported, as the spec does not mention it.a = b = cneeds parentheses).The grammar follows whatever the spec decides on these.
Dependencies
No new runtime dependency. The tests use the ANTLR 4.13.2 tool (downloaded from Maven Central into the git-ignored
dev/lib/, verified against a pinned SHA-256) andantlr4-python3-runtime4.13.2, both BSD-3-Clause (ASF Category A), pluspytestandpyyaml.Related Issues
https://lists.apache.org/thread/s5x6lo5gvxhyowb4pcohtplnly5rmgtm
Supported by Jean-Baptiste Onofré.
Checklist
Specification
core-spec/and follow the existing structureOntology
ontology/are consistent with spec changesConverters
Validation
validation/are updated if the spec changedDocumentation
docs/is updated to reflect any user-facing changesCONTRIBUTING.mdis updated if the contribution process changedExamples
examples/are added or updated for any new spec constructsTests
pytest/ CI green)Compliance
NOTICEand/orLICENSEhave been updated per ASF policy