Is it possible to run rascal programs from the command line?

北城以北 提交于 2019-12-11 11:35:17

问题


I know how to run rascal code from within eclipse and how to use the REPL, but I don't know how I can run a rascal file (or group of rascal files) as a program from the command line.

When I try the following, I get a parse error:

$ java -Xmx1G -Xss32m -jar rascal-shell-stable.jar mymodule.rsc
Version: 0.7.2.201501130937
Parse error in cwd:///mymodule.rsc from <1,11> to <1,12>

The contents of mymodule.rsc:

module mymodule

println("hello world");

What am I doing wrong?


回答1:


Well, your mymodule.rsc is actually syntactically incorrect and will also give parse errors in the Eclipse IDE. Here is an improved version:

module mymodule

import IO;

value main(list[value] args) {
    println("hello world");
}

Bonus: you should also add import IO; to make the println function available.



来源:https://stackoverflow.com/questions/28046840/is-it-possible-to-run-rascal-programs-from-the-command-line

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