是否可以从命令行运行rascal程序? [英] Is it possible to run rascal programs from the command line?

查看:98
本文介绍了是否可以从命令行运行rascal程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在eclipse中运行rascal代码以及如何使用REPL,但是我不知道如何从命令行作为程序运行rascal文件(或rascal文件组)。



尝试以下操作时,出现解析错误:

  $ java -Xmx1G -Xss32m -jar rascal-shell-stable.jar mymodule.rsc 
版本:0.7.2.201501130937
从< 1,11>解析cwd:///mymodule.rsc中的错误。至< 1,12>

mymodule.rsc 的内容:

  module mymodule 

println( hello world);

我在做什么错了?

解决方案

好吧,您的 mymodule.rsc 实际上在语法上是不正确的,并且还会在Eclipse IDE中提供解析错误。这是一个改进的版本:

  module mymodule 

import IO;

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

奖金:您还应该添加 import IO; 使 println 函数可用。


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?

解决方案

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.

这篇关于是否可以从命令行运行rascal程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆