(2.13.0) How to use scala.tools.nsc.interpreter.IMain.compile()

Hello gurus and mates,

I am seeking solutions to load script from a scala file. And the host language is Scala too.
Can anyone share some sample snippet about how to use “scala.tools.nsc.interpreter.IMain.compile()” ??

I found some sample codes online but all of them use older version where the API is quite different. Since I am a novice to Scala I am not able to convert old sample to 2.13.0 API by simply look into the lib code.

Thanks a lot

What difficulty did you encounter when attempting to adapt the existing example code?

1 Like

Hi Seth

Thanks for your attention on this post. My problem was, I am totally new to interpreter lib and could not find any reference codes for 2.13.0 version.

I switched to 2.12.10 and managed to find some samples which guided me through.

But I find that this interpreter solution cannot share same coding scope between the host code and interpreted codes, which cannot suite to my requirement. So I have turned to external DSL solution

Thanks a lot anyway

1 Like