Running a Rascal program from outside the REPL

可紊 提交于 2019-12-13 02:05:57

问题


I'd really like to be able to run some Rascal's program from outside the REPL (e.g. as part of a script, or called from another program). What I'm using Rascal for is and intermediate stage in a larger framework so I am wondering what the best way to go about integrating executing the Rascal code from another program.


回答1:


Right now the best way is to package your code together with the Rascal shell executable jar. There is a convenience class JavaToRascal for calling into Rascal code. Sometimes it requires some thinking to add your own modules to the Rascal search path using IRascalSearchPathContributors, but if you include a RASCAL.MF file with the right properties it all should go automatically.

If you are thinking of an Eclipse plugin, then the best way is to let your plugin depend on the rascal-eclipse plugin and use ProjectEvaluatorFactory to get access to the interpreter.

Caveat: since we are moving to a compiled system, the code you write for this kind of integration will change. This is the reason we haven't documented the API for calling Rascal from Java yet.



来源:https://stackoverflow.com/questions/29635063/running-a-rascal-program-from-outside-the-repl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!