Skip to content

Grammar improvements: validations, optional semicolons, entry rules#120

Merged
spoenemann merged 8 commits into
mainfrom
grammar-validation
Jun 25, 2026
Merged

Grammar improvements: validations, optional semicolons, entry rules#120
spoenemann merged 8 commits into
mainfrom
grammar-validation

Conversation

@spoenemann

@spoenemann spoenemann commented Jun 24, 2026

Copy link
Copy Markdown
Member
  • Adds missing validations and fixes [Grammar] Implement additional grammar validations #119.
  • Makes semicolons optional. Note: for parser rules and composite rules, a semicolon is still needed if another parser rule follows after that because it starts with an ID. Maybe we can improve the lookahead for this specific case later.
  • Consistently call grammar interface fields "fields" instead of "properties" in error messages.
  • Added: New entry keyword to explicitly mark the grammar's entry rule

@spoenemann spoenemann requested a review from msujew June 24, 2026 14:41
@msujew

msujew commented Jun 24, 2026

Copy link
Copy Markdown
Member

Makes semicolons optional. Note: for parser rules and composite rules, a semicolon is still needed if another parser rule follows after that because it starts with an ID. Maybe we can improve the lookahead for this specific case later.

You can change the decision for that to use LL instead of SLL. That way, it will parse correctly (at the cost of a bit of performance).

@spoenemann

Copy link
Copy Markdown
Member Author

Makes semicolons optional. Note: for parser rules and composite rules, a semicolon is still needed if another parser rule follows after that because it starts with an ID. Maybe we can improve the lookahead for this specific case later.

You can change the decision for that to use LL instead of SLL. That way, it will parse correctly (at the cost of a bit of performance).

Ok like this?

@spoenemann spoenemann changed the title Grammar improvements: missing validations, optional semicolons Grammar improvements: validations, optional semicolons, entry rules Jun 25, 2026
@msujew

msujew commented Jun 25, 2026

Copy link
Copy Markdown
Member

Ok like this?

I originally had something different in mind - but that doesn't seem to work correctly (for some reason). Your solution works well 👍

@msujew msujew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that helps a lot. Just one comment - also I want some feedback for the optional ; at the end of rules. @cdietrich care to chime in? WDYT?

Comment thread internal/grammar/validator.go
Comment thread workspace/document_validator.go Outdated
@spoenemann spoenemann merged commit 8afe5ed into main Jun 25, 2026
5 checks passed
@spoenemann spoenemann deleted the grammar-validation branch June 25, 2026 10:48
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.

[Grammar] Implement additional grammar validations

2 participants