Is there an API for programming Scala REPL programmatically?

Based on the stream and Scala interpreter sources it seems that it would not be so difficult to get the equivalent

def runLine(line: String): String 

but has someone written this already?

+7
source share
1 answer

There are many examples floating there, but they can be hard to find. Here is the one I wrote some time ago:

http://code.google.com/p/simplex3d/source/browse/trunk/Simplex3dConsole/src/simplex3d/console/SimpleInterpreter.scala?r=790

The tricky part is getting the interpreter to load javascript. I downloaded banks manually to make it work with web launch, but in your case it might just be settings.usejavacp.value = true .

You can see the interpreter in action here: http://www.simplex3d.org/console/

+5
source

All Articles