简体   繁体   English

将Rascal项目与Java项目集成

[英]Integrating a Rascal project with a Java Project

I developed a code generator in Rascal and I want to integrate it with a tool developed in Java. 我用Rascal开发了一个代码生成器,我想将其与用Java开发的工具集成在一起。 I tried to generate a jar file for the Rascal project with eclipse to put into the Java project, but it just puts the Rascal files of the project into the jar. 我试图用Eclipse将Rascal项目生成一个jar文件放入Java项目中,但是它只是将项目的Rascal文件放入了jar中。 I searched into Rascal Tutor and here, but I didn't find nothing about it. 我在这里搜索了Rascal Tutor,但没有找到任何相关信息。

Someone knows how I can do this? 有人知道我该怎么做吗?

As of yet, this scenario is not that straightforward (also see discussion in github issue #57 ). 到目前为止,这种情况还不是那么简单(另请参见github问题#57中的讨论)。 In principle, it is possible to call Rascal from java, but you would have to construct the Evaluator and import modules and call functions, and do the translation from our IValues to your java data type. 原则上,可以从Java调用Rascal,但是您将必须构造Evaluator并导入模块和调用函数,并将IValues转换为Java数据类型。

For inspiration on how to initialize an Evaluator: https://github.com/cwi-swat/rascal-shell/blob/master/src/org/rascalmpl/shell/RascalShell.java 有关如何初始化评估器的启发,请访问: https : //github.com/cwi-swat/rascal-shell/blob/master/src/org/rascalmpl/shell/RascalShell.java

The other way around, might work more easily. 反之,则可能更容易工作。 It is easy to call a Java method in Rascal and adding your own menu option in a Java editor is also straightforward . 在Rascal中调用Java方法很容易,并且在Java编辑器中添加自己的菜单选项也很简单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM