Correct me if I am wrong: the Kotlin compiler was ...
# getting-started
s
Correct me if I am wrong: the Kotlin compiler was originally written in Java. Meaning, a Java program
J
was written to parse the AST of a KT file(s) (the first Kotlin compiler, written in Java) and produce an executable/binary. Program
J
(the binary that Java produced from source code
J
) was then used to compile a Kotlin program
K
that itself could read KT files (the second Kotlin compiler, written in Kotlin) and produce a binary. The binary produced from
K
was used to compile an iteratively better version
K1
, which was used to compile
K2
, etc. Somewhat based on this. Does the current compiler rely on the JVM to run?
h
Yes, the current compiler (still) requires a JVM, mostly because it uses jvm only (and often Java) 3rd party dependencies, like IntelliJ.
d
FYI this process, when compiler is used for compilation of compiler itself called bootstraping We update bootstrap version of compiler every two weeks, using fresh builds from
master
branch
k
This is how it is for any new language that wants to have its compiler eventually written in itself. Bootstrap in another language, mostly C.
s
The Zig guys recently discussed the bootstraping solution space when announcing that they've now ditched their old compiler written in C++ for one written in Zig. To be honest, it blow my mind 🤯 https://ziglang.org/news/goodbye-cpp/ I love the animation they used to show how happy they were to ditch C++ 😂 https://ziglang.org/news/goodbye-cpp/mario-betrays-yoshi.webm