Last active
December 17, 2015 03:59
-
-
Save jugyo/5547481 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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