I need embed Scala REPL functionality in my Scala Application. How can I do that ? Which Scala method/class I need to call ?
I take a look at scala.tools.nsc.interpreter package but I don't see how to do that.
I need embed Scala REPL functionality in my Scala Application. How can I do that ? Which Scala method/class I need to call ?
I take a look at scala.tools.nsc.interpreter package but I don't see how to do that.
@som-snytt gave me a tip and I got the solution.
import scala.tools.nsc.interpreter._
val lines: List[String] = List("println(\"Hello\")", "println(\"Word\")")
val ret: String = ILoop.run(lines)
// Verify if all runs OK
// Read stdin
val condition = ...
while (condition) {
// convert to List[String]
val ret: String = ILoop.run(lines)
// format and print the output
println(ret)
// Read stdin again
}