{"id":187564,"date":"2021-10-07T10:10:05","date_gmt":"2021-10-07T09:10:05","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=kotlin&#038;p=187564"},"modified":"2022-05-18T19:57:26","modified_gmt":"2022-05-18T18:57:26","slug":"the-road-to-the-k2-compiler","status":"publish","type":"kotlin","link":"https:\/\/blog.jetbrains.com\/ja\/kotlin\/2021\/10\/the-road-to-the-k2-compiler","title":{"rendered":"The Road to the K2 Compiler"},"content":{"rendered":"\n<p>We\u2019ve 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.<\/p>\n\n\n\n<p>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\u2019t use them.<\/p>\n\n\n\n<p>We\u2019re 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:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>New Type Inference algorithm<\/td><td>Stable in 1.4.0<\/td><\/tr><tr><td>New JVM IR backend<\/td><td>Stable in 1.5.0<\/td><\/tr><tr><td>New JS IR backend<\/td><td>Stable in 1.6.*<\/td><\/tr><tr><td>New frontend<\/td><td>In active development<br>Preview in 1.6.20 or 1.7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In the following video about our adventure of rewriting the Kotlin compiler, we will:<\/p>\n\n\n\n<ul><li>Provide more details about different parts of the compiler, including the basics of the compiler theory.<\/li><li>Explain the differences between the compiler frontend and backend.<\/li><li>Explain the differences between the old backends and the IR backends.<\/li><li>Highlight what is changing in the new frontend.<\/li><li>Explain why we\u2019ve chosen to name the new compiler K2.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"The Road to the New Kotlin Compiler\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/iTdJJq_LyoY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>If you want to learn more technical details about the new frontend, please join the live talk \u201cK2 Compiler: a top-down view\u201d at the <a href=\"https:\/\/pages.jetbrains.com\/kotlin-premier-event-2021\" target=\"_blank\" rel=\"noopener\">Kotlin 2021 Premier Online Event<\/a> 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.<\/p>\n\n\n\n<p align=\"center\"><a class=\"ek-link jb-download-button\" title=\"Register for the K2 Compiler live talk\" href=\"https:\/\/pages.jetbrains.com\/kotlin-premier-event-2021\" target=\"_blank\" rel=\"noopener\">Register for the K2 Compiler live talk<\/a><\/p>\n\n\n\n<p><strong>Related links:<\/strong><\/p>\n\n\n\n<ul><li><a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew14.html#new-more-powerful-type-inference-algorithm\" target=\"_blank\" rel=\"noopener\">New more powerful type inference algorithm in Kotlin 1.4.0<\/a><\/li><li><a href=\"https:\/\/kotlinlang.org\/docs\/whatsnew15.html#stable-jvm-ir-backend\" target=\"_blank\" rel=\"noopener\">Stable JVM IR backend\ufeff in Kotlin 1.5.0<\/a><\/li><li><a href=\"https:\/\/kotlinlang.org\/docs\/js-ir-compiler.html\" target=\"_blank\" rel=\"noopener\">Kotlin\/JS IR compiler<\/a><\/li><\/ul>\n","protected":false},"author":42,"featured_media":189301,"comment_status":"open","ping_status":"closed","template":"","categories":[89],"tags":[],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/187564"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/types\/kotlin"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/comments?post=187564"}],"version-history":[{"count":4,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/187564\/revisions"}],"predecessor-version":[{"id":246631,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/kotlin\/187564\/revisions\/246631"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media\/189301"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/media?parent=187564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/categories?post=187564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/tags?post=187564"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/ja\/wp-json\/wp\/v2\/cross-post-tag?post=187564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}