Custom Target/Backend


#1

With the JVM and JS supported and native coming up, undoubtedly a solid abstraction has been building. I have quickly perused the code and see that there is an IR among other abstractions.

I might want to target a custom backend/runtime. What is the stability of the abstraction and is it feasible for me to follow https://github.com/JetBrains/kotlin/tree/master/js as a blueprint of the APIs to touch for my own “transpiler”?


#2

Just of curiosity what would that be?
BTW js/ is ~140Ksloc with tests not a small project, and it is relatively simple transform
I would guess nobody tested actual dependency separation for other parts of project and adding more backends roots into main code base. So +~350Ksloc with tests. My raw estimate for adding new target with js level complexity would be ~250Ksloc which is 5-10man years worth of work.


#3

I was just gonna see about transpiling to Go or something to see if I could get cross use. I’ve done it w/ low level JVM bytecodes as a pet project, but curious how well Kotlin’s IR will map. It’s more exploratory than anything at this point.


#4

The IR is very much work in progress and is not used by either the JVM or the JS backend. The stability of the abstraction is therefore non-existent.