The Road to the K2 Compiler
We’ve been working on a new K2 Kotlin compiler for quite some time. The new compiler aims to speed up the development of new language features, unify all the platforms Kotlin supports, bring performance improvements, and provide an API for compiler extensions.
The development of the Kotlin compiler started many years ago, and many things have changed since that time. For example, in Kotlin 1.0, there was no Kotlin/Native backend and no coroutines, so Kotlin compiler code simply couldn’t use them.
We’re introducing new components step-by-step so that they reach you as soon as possible. Many parts are already used in the latest Kotlin versions, and others are on their way:
|New Type Inference algorithm||Stable in 1.4.0|
|New JVM IR backend||Stable in 1.5.0|
|New JS IR backend||Stable in 1.6.*|
|New frontend||In active development|
Preview in 1.6.20 or 1.7
In the following video about our adventure of rewriting the Kotlin compiler, we will:
- Provide more details about different parts of the compiler, including the basics of the compiler theory.
- Explain the differences between the compiler frontend and backend.
- Explain the differences between the old backends and the IR backends.
- Highlight what is changing in the new frontend.
- Explain why we’ve chosen to name the new compiler K2.
If you want to learn more technical details about the new frontend, please join the live talk “K2 Compiler: a top-down view” at the Kotlin 2021 Premier Online Event by the lead developers of the new frontend, Simon Ogorodnik, and Mikhail Glukhikh. They are going to highlight the process of rewriting the Kotlin compiler using FIR (frontend intermediate representation) and will answer your questions.
- New more powerful type inference algorithm in Kotlin 1.4.0
- Stable JVM IR backend in Kotlin 1.5.0
- Kotlin/JS IR compiler
Subscribe to Blog updates
Thanks, we've got you!
Tackle Advent of Code 2023 With Kotlin and Win Prizes!
Unwrap the joy of coding challenges as we gear up for Advent of Code, which JetBrains is proud to be sponsoring for a third consecutive year! Starting December 1, the JetBrains community will be diving into 25 days of coding challenges at adventofcode.com, and we warmly invite you to participate using Kotlin.
Kotlin News: Latest Releases, Kotlin Support in Fleet, Kotlin Multiplatform Content Creators, and More
The new Kotlin digest is live! Learn about the latest releases and other news and updates in the Kotlin ecosystem.
Join Us for a Live Introduction to Algorithmic Challenges in Kotlin!
Are you preparing for technical interviews, or do you simply want to master algorithms? Join us for a practical livestream where we’ll introduce the Algorithmic Challenges in Kotlin course!