Standalone Kotlin REPL?

Is there a standalone REPL for Kotlin like the Scala REPL? I’m only aware of the REPL shipped with IntelliJ IDEA. This is indeed a very nice (although not mature yet) tool, but it is coupled to the currently opened project (as far as I know). Sometimes it would be better to have a separate REPL that could be started outside of the IDE.

Is there a REPL that can be started without the IDE? Or can the existing REPL be used this way?

https://kotlinlang.org/docs/tutorials/command-line.html#running-the-repl

Thanks. I wasn’t aware of this possibility.

So a REPL is cool, but does anyone know where in the standard library I would have to look if I wanted to build something more akin to Groovy Console than a REPL? I find the Groovy Shell to be an absolute pleasure compared to shell-based REPL’s. Is the Kotlin compiler exposed via API somewhere?

1 Like

There is no stable and documented API for the Kotlin compiler at the moment. You can depend on the kotlin-compiler jar and use what’s there, but we provide no guarantees regarding the stability of this API between releases.