- Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(tablegen): add MLIR TableGen grammar #4107
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
base: master
Are you sure you want to change the base?
Conversation
| | ||
| // ArgValueList ::= PostionalArgValueList [","] NamedArgValueList | ||
| argValueList | ||
| : positionalArgValueList (',')? namedArgValueList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could remove the extra parentheses here and in a few other places?
$ bash /c/Users/Kenne/Documents/GitHub/g4-scripts/find-useless-parentheses.sh Using built-in parser. CSharp 0 TableGen.g4 success 0.0477444 Computing useless parentheses in TableGen.g4 Using built-in parser. CSharp 0 TableGen.g4 success 0.0477226 Found useless parentheses in grammars... TableGen.g4:L100: : positionalArgValueList (',')? namedArgValueList ^ TableGen.g4:L333: : '(' dagArg (dagArgList)? ')' ^ TableGen.g4:L460: DecimalInteger : ('+' | '-')? (UDigit)+; ^ TableGen.g4:L464: TokIdentifier : (UDigit)* UAlpha (UAlpha | UDigit)*; ^ TableGen.g4:L455: TokString : '"' (~('"') | Escape)* '"'; ^ TableGen.g4:L457: TokCode : '[{' (~(']') | ']' ~('}') | Escape)*? '}]'; ^ TableGen.g4:L457: TokCode : '[{' (~(']') | ']' ~('}') | Escape)*? '}]'; ^ 05/25-06:29:01 ~/issues/g4-4107/tablegen/Generated-CSharp | Defset : 'defset'; | ||
| Defvar : 'defvar'; | ||
| Deftype : 'deftype'; | ||
| Field : 'field'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field (and fragment EOL below) are unused. Is something missing?
$ bash /c/Users/Kenne/Documents/GitHub/g4-scripts/find-unused-lexer-symbols.sh No arguments were provided. Finding unused lexer symbols in grammars... ./desc.xml 1st pass: fold string literals in parser rules to make explicit lexer rule used. 2nd pass: find unreferenced lexer rule symbols. Field EOL 05/25-06:32:18 ~/issues/g4-4107/tablegen/Generated-CSharp | @@ -0,0 +1,454 @@ | |||
| //===- ToyOps.td - Toy dialect operation definitions -------*- tablegen -*-===// | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coverage for this one test is ~50%, but perhaps you could add additional tests to cover more of the grammar?
$ trcover.exe ../examples/ToyOps.td Parsing grammar C:/msys64/home/Kenne/issues/g4-4107/tablegen/Generated-CSharp/TableGen.g4 CSharp 0 ../examples/ToyOps.td success 0.0336701 Analyzing... Analysis 0 ../examples/ToyOps.td 0.0115427 05/25-06:39:13 ~/issues/g4-4107/tablegen/Generated-CSharp Output: cover.html.txt
| Looking at the build results, @kaby76 , is this an bug in the Antlr Python generator? |
| The problem is rule True. It's a symbol conflict. |
| Hey this would still be a really nice addition, let me know I can easily help. |
https://llvm.org/docs/TableGen
https://llvm.org/docs/TableGen/ProgRef.html