是否可以从命令行运行rascal程序?

编程入门 行业动态 更新时间:2024-10-27 15:21:29
本文介绍了是否可以从命令行运行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程序?

本文发布于:2023-11-13 21:54:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585422.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   程序   rascal

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!