Hi everyone! I found this repository on Kotlin <h...
# compiler
m
Hi everyone! I found this repository on Kotlin https://github.com/Kotlin/grammar-tools and I have tried to use it; but the properties of the tree and subtrees are private and last build of the tool was produced by April 2019. How does one go about getting it updated? I have also tried to build it myself but there's a dependency missing so I can't build it. There are issues created in the repo but seems there isnt so much activity
m
grammar-tools started as an internal support library which is used to test out the grammar. Which exact use-case do you have for it? The missing dependency (I assume "org.jetbrains.kotlin.spec.grammarkotlin grammar parserwharever") is from the specification itself: https://github.com/kotlin/kotlin-spec and is supposed to be explicitly provided as a jar file (you can find it after fully building the specification).
This is all unfortunate, but, again, this project was never intended for external users and is just a simple wrapper over aforementioned dependency which, itself, is just a simple wrapper over the grammar file compiled by ANTLR. Maybe you are better off just using the grammar directly?
m
I’m trying to parse a certain package of my app to generate some JSON schema (automate swagger openapi json file) without compiling the entire application and later introspecting the jar file
m
There's also kotlinx-ast project https://github.com/kotlinx/ast which uses the same ANTLR grammar, but is thoroughly supported and more user-friendly
👀 2
m
Thanks I’ll take a look at it. So far I had to use reflection to make the previous dependency’s properties public so I could read them
m
In any case, whether you decide to continue fighting your way through grammar-tools or not, you can file an issue describing your difficulties, the repo is not entirely unsupported and it definitely won't hurt 😃
m
I am so willing to make the switch to something that’s currently supported 🙂 I’ll just take a read once I’m off work
Thank you for your kind help