Hello everybody, thanks for accepting my request t...
# announcements
m
Hello everybody, thanks for accepting my request to join this slack channel. Does anybody have an idea on how to get the compiler's front-end result (static and gramatic analysis) of the source files? Is this even possible to do currently?
n
you might try #C7L3JB43G that's a pretty niche ask 🙂
🙏 1
m
I'm still a newbie on Slack: I thought only these were the available channels 🤔
n
yeah there are 508 channels 🙂
c
Projects like #CKS3XG0LS and #C0F4UNJET both hook directly into the compiler/AST, so it’s definitely possible. Might be worth asking in those channels as well, the devs of those projects probably hang around there. Or just go look at the source code for them https://github.com/pinterest/ktlint https://github.com/Kotlin/dokka
🙏 1
n
I'd expect dokka/ktlint to re-parse the source code and not hook into the existing compilation process
m
Makes a ton of sense, I'll start looking into their source code!
c
yeah, from the little I understand of them, they basically embed the Kotlin compiler and run it directly like a library. I don’t think they reuse outputs from the normal Gradle compilation tasks, but they’re plenty fast enough without needing to do that.
y
Yep definitely go to #C7L3JB43G, and search "AnalysisHandler" there, which will give you some interesting results about how to get the kotiln AST along with all the type inference and analysis that the compiler did.