2

Installed the MLton compiler on Ubuntu (sudo apt-get install mlton) and had no problems (seemingly) with installation.

When I try to use it (e.g. "mlton test.sml") it sits for a second and then returns nothing. If I try to print something in the file I'm trying to compile, nothing. However, weird part is if I give it bad ML code ("x = 2", without val), it spits out regular errors like "Undefined variable," etc.

I've looked on here, and elsewhere online, and nothing seems to concern what I'm experiencing. Perhaps I'm just using it wrong?

Thanks in advance.

sshine
  • 15,635
  • 1
  • 41
  • 66
P. Davis
  • 33
  • 1
  • 5

1 Answers1

5

mlton is a non-interactive compiler; it compiles the program, and that's it. You can run the program later if you want.

So, for example, if test.sml is a valid Standard ML program, then this:

mlton test.sml     # compile the program

will compile it and emit a Linux executable file named test. You then run that executable file like this:

./test             # run the program

If you want to compile and run the program with a single command, you can use your shell's && feature to run two programs (but only running the second if the first one had succeeded):

mlton test.sml && ./test
ruakh
  • 175,680
  • 26
  • 273
  • 307
  • hahahaha...oh boy. I should have known that. Woo. Thank you! I've spent all day dealing with other programs that weren't working and I guess I was just automatically discouraged – P. Davis Apr 30 '18 at 05:35