0
votes

The SML file: "test.sml"

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

I've installed SMLNJ 110.76 from here: http://www.smlnj.org/dist/working/110.76/, Emacs 24.3.1 from here: http://ftp.gnu.org/gnu/emacs/windows/emacs-24.3-bin-i386.zip, and SML Mode for Emacs through the Emacs GUI.

The Emacs stack trace is this:

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

and so on, ending with:

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

I also tried the same program via Sublime Text 3 with the SML and sublimeREPL packages as laid out here: http://developerinmotion.wordpress.com/2013/02/07/sublime-text-2-and-sml/. But I'm getting the same problem: a long list of illegal token syntax errors followed by:

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

What's the problem? Have I installed SMLNJ incorrectly?

2
Try adding a blank line after the comment.Bleeding Fingers

2 Answers

0
votes

I put your two lines in a file (test.sml) and opened in a standard SML REPL. It compiles normally:

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

It seems that you have problems with setting your tools.

0
votes

This problem may result from creating .sml file using UTF-8 character encoding. pls use ANSI instead.