[patch] Fix EBNF grammar, TextMate grammar#343
Merged
Conversation
The EBNF grammar for layer declarations and layerblock statements
was incorrect and did not match the actual syntax used in examples
throughout the specification.
Layer declarations use 'bind' or 'inline' keywords, not arbitrary
strings. Layerblock statements do not use an 'of' keyword and do
not contain port declarations.
This updates the EBNF to match the actual syntax:
- decl_layer: 'layer' id ',' ('bind' | 'inline') ':'
- layerblock: 'layerblock' id ':'
AI-assisted-by: Augment (Claude Sonnet 4.5)
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add support for three legacy FIRRTL syntaxes that are no longer in the specification but may still appear in older code: 1. Legacy connect: 'foo <= bar' (equivalent to 'connect foo, bar') 2. Legacy partial connect: 'foo <- bar' (no modern equivalent) 3. Legacy invalidate: 'foo is invalid' (equivalent to 'invalidate foo') All three legacy operators are highlighted with the scope name 'keyword.operator.legacy.firrtl' to distinguish them from modern syntax. Additionally, fix several issues with layer and control flow syntax highlighting: - Fix 'enablelayer' on modules to support multiple occurrences - Improve visibility of 'layer' and 'layerblock' keywords - Fix 'else when' syntax to properly highlight expressions - Update layer pattern to match 'bind'/'inline' conventions - Simplify layerblock pattern to match actual syntax AI-assisted-by: Augment (Claude Sonnet 4.5) Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
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.
Fix mistakes in the EBNF grammar related to layers and layerblocks.
Fix many, many issues with the TextMate grammar with AI assistance. I did not
inspect the TextMate grammar changes. I did look at the output in VSCode with
this grammar loaded and
llvm/circt'stest/Dialect/FIRRTL/parse-basic.firnowactually parses correctly.