Kotlin compiler on the browser?

Has anybody tried to compile the Kotlin/Compiler with Kotlin.JS?
I want to provide a playground that compiles to JS in the browser directly, but without having to require a backend to do the job.

I have tried to use TeaVM to compile it, but even providing 20GB of ram can’t compile that artifact only doing this: K2JVMCompiler.main(new String[0]);

So I guess the kotlin-compiler-embedable should be the artifact to port ideally to Kotlin/Common.
Someone did already any effort in that direction? If it is using java classes maybe it is possible to provide a compatibility layer or something.

1 Like

So I guess the kotlin-compiler-embedable should be the artifact to port ideally to Kotlin/Common.

I think its far form perfect.
Even if you remove unneeded modules (like JVM compiler backend which is not needed in your case),
there are still many compiler components that are heavily tied to JVM,
e.g. parser-glorified-AST-thingy called PSI, the legacy from early IDEA times.