0

SML 文件:“test.sml”

(* here is a comment *)
val x = 123;

我从这里安装了 SMLNJ 110.76:http ://www.smlnj.org/dist/working/110.76/,从这里安装了Emacs 24.3.1:http: //ftp.gnu.org/gnu/emacs/windows/emacs -24.3-bin-i386.zip和 Emacs 的 SML 模式,通过 Emacs GUI。

Emacs 堆栈跟踪是这样的:

test.sml:1.2 Error: illegal token
test.sml:1.3 Error: illegal token
test.sml:1.5 Error: illegal token
test.sml:1.7 Error: illegal token
test.sml:1.9 Error: illegal token

依此类推,以:

uncaught exception Compile [Compile: "syntax error"]
raised at: ../compiler/Parse/main/smlfile.sml:15.24-15.46
           ../compiler/TopLevel/interact/evalloop.sml:44.55
           ../compiler/TopLevel/interact/evalloop.sml:296.17-296.20

我还通过 Sublime Text 3 使用 SML 和 sublimeREPL 包尝试了相同的程序,如下所示:http: //developerinmotion.wordpress.com/2013/02/07/sublime-text-2-and-sml/。但是我遇到了同样的问题:一长串非法令牌语法错误,然后是:

C:\Program Files (x86)\SMLNJ\\bin\.run\run.x86-win32.exe: Fatal error -- Uncaught exception Compile with "syntax error" raised at ../compiler/Parse/main/smlfile.sml:15.24-15.46

有什么问题?我是否错误地安装了 SMLNJ?

4

2 回答 2

0

我把你的两行放在一个文件(test.sml)中,并在一个标准的 SML REPL 中打开。它正常编译:

- use "test.sml";
[opening test.sml]
val x = 123 : int
val it = () : unit

您似乎在设置工具时遇到问题。

于 2013-11-16T12:21:31.420 回答
0

此问题可能是由于使用 UTF-8 字符编码创建 .sml 文件造成的。请改用 ANSI。

于 2016-08-15T03:57:14.297 回答