Skip to content

Instantly share code, notes, and snippets.

@jugyo
Last active December 17, 2015 03:59
Show Gist options
  • Save jugyo/5547481 to your computer and use it in GitHub Desktop.
Save jugyo/5547481 to your computer and use it in GitHub Desktop.
import scala.tools.nsc.Settings
import scala.tools.nsc.interpreter.{ExprTyper, IMain}
object Example extends App {
val settings = new Settings()
settings.usejavacp.value = true
val main = new IMain(settings)
object exprTyper extends { val repl: main.type = main } with ExprTyper { }
val result = exprTyper.parse(
"""
|object HelloWorld {
| def main(args: Array[String]) {
| println("Hello, world!")
| }
|}
""".stripMargin)
println(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment