grammars-v4
grammars-v4 copied to clipboard
chore: Solidity language update
Updates the parser definitions to the latest spec
This change breaks the target independence of the previous version, which means someone is going to have to fix all this code.
boolean in boolean payableSet is a Java type.
For C#,
C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\obj\Debug\net5.0\SolidityLexer.cs(38,72): warning CS0108: 'SolidityLexer.Emit' hides inherited member 'Lexer.Emit(IToken)'. Use the new keyword if hiding was intended. [C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\Test.csproj]
C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\obj\Debug\net5.0\SolidityLexer.cs(45,11): warning CS0108: 'SolidityLexer.Type' hides inherited member 'Lexer.Type'. Use the new keyword if hiding was intended. [C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\Test.csproj]
C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\obj\Debug\net5.0\SolidityParser.cs(4071,54): error CS0246: The type or namespace name 'boolean' could not be found (are you missing a using directive or an assembly reference?) [C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\Test.csproj]
C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\obj\Debug\net5.0\SolidityParser.cs(1912,10): error CS0246: The type or namespace name 'boolean' could not be found (are you missing a using directive or an assembly reference?) [C:\msys64\home\kenne\solidity\grammars-v4\solidity\Generated\Test.csproj]
Emit: 'emit'; Type: 'type'; Function: 'function';
Emit and Type are reserved words in at least the C# target. Function is a reserved word in the Dart target. There are likely other symbol conflicts.
For the Dart target, in rule inheritanceSpecifierList, the use of variable inheritanceSpecifiers creates two definitions, which craps out the Dart compiler:
List<InheritanceSpecifierContext> inheritanceSpecifiers = List<InheritanceSpecifierContext>();
List<InheritanceSpecifierContext> inheritanceSpecifiers() => getRuleContexts<InheritanceSpecifierContext>();
This is a bug in the Dart target.
There still are no examples.
I only tested this with trgen for Java, CSharp, and Dart.
At the least, the "skip lists" should be adjusted so the build will pass.
Yes i noticed that there are no tests for this.
Also, there are two antlr grammars for solidity: one provided by the team and one maintained by the community. The community version is a bit more lax in its parsing, can see if that one would work better?
Thanks,
Sam
Well, one grammar is preferable to two I think.
But, the main problem is that target-specific dependencies will be re-introduced, intentionally or not.
Having put in hundreds of hours porting many of the grammars in this repo, I'm have concluded that maintaining a repo with target-agnostic grammars is not sustainable unless it can be automated.
Or, we need to understand and address why target-specific code has to be introduced in the first place. There are many things I like about Antlr, there are several things other parser generators do better.
@sambacha are you planning to continue this PR?
@sambacha are you planning to continue this PR?
Are you interested in taking it over?
Let me know how I can help!
I'm not going to be able to take it over. If you are not planning to continue with it, I will close it. You are welcome to re-open it if you plan to work on it.