-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Kotlin grammars #3965
Comments
In addition, NL and semi are cavalierly sprinkled throughout the grammar, which causes ambiguity and quite poor performance. There is no theoretical, consistent, thought-out manner of how it should be used, and where it should be used. For example, consider how propertyDeclaration is parsed. Input:
This input causes large k lookahead because the parser requires full context to understand when to use the NL, whether in propertyDeclaration, or in topLevelObject. It is even wrong in the "spec" grammar implementation. There is even a faux pas following the wrong "NL*" use in the production. "(getter? (NL* semi? setter)? | setter? (NL* semi? getter)?)" is an alt with both sides that can derive empty. A grammar should never offer the choice of empty vs empty!
If you correct the NL's in propertyDeclaration and getter/setter, the max-k's are somewhat resolved.
|
I am trying to investigate antlr/antlr4-lab#83.
There are two Kotlin grammars: kotlin and kotlin-formal. In addition, one can find the kotlin grammar in the Jetbrains repo (https://github.com/Kotlin/kotlin-spec/tree/4b29a8b42e08237f45c0c3c185eaae4bba3751f6/grammar/src/main/antlr).
The readmes in the two kotlin grammars in this repo don't explain why there are two, what the differences are, and don't explain which one to chose.
What version do either of these grammars intend to support? There is no version information of which release.
The link
grammars-v4/kotlin/kotlin-formal/README.md
Line 7 in 1bfcc5a
kotlin-formal is tested.
grammars-v4/kotlin/kotlin-formal/desc.xml
Line 3 in 1bfcc5a
kotlin is not tested.
grammars-v4/kotlin/kotlin/desc.xml
Line 3 in 1bfcc5a
The text was updated successfully, but these errors were encountered: