Hey I am really interested in studying the source ...
# getting-started
m
Hey I am really interested in studying the source code, but I am finding it very laborious to grasp what's going on by just reading the source at https://github.com/JetBrains/kotlin . I can understand the concepts like IRs, parsing, ..., but I don't grasp the folder structures, filenames and ideas regarding encapsulation. Any ideas on how to proceed? TBH I'm finding it odd how such code can get into big corp's stack, but maybe I'm misled by its organization.
d
What parts of compiler are you interested in? Most code of frontend and JVM backend lays in
:compiler
folder •
:compiler:fir
is root module for K2 comiler frontend •
:compiler:ir
contains common, JVM and JS parts of backend
Also for questions about compiler there is a #compiler channel
m
Ideally I want to know the full thing down to JVM bytecode. But I'm confused by all the folder names and contents.
d
In this case it's easier to setup project in IDE, open some root entrypoint (like this part in CLI) and just navigate to things you are interested as deep as you want
m
Moving to #compiler
Hmm, possibly the project has been made so that the analysis tools "are" the doc?
I don't know, maybe this is some pro-developer thing.
But e.g. in the linked part above I don't know why it's under CLI, which I thought is "command line interface". The compiler code to me should not depend on a command line interface.
d
CLI is part of compiler as a product, which allows user to run compilation (this code is called when someone call
kotlinc
by hand or via build system) So basically it is some root point which calls compiler (as a subsystem) with configuration, passed from command line arguments I can point to other similar entrypoints, but all they do effectively the same (for your taks): prepare configuration and call compiler