Errors Compiling Troll

Errors Compiling Troll

Return to topic list

Thu Jan 14 20:15:20 2016   by   Razorfire

Hey, I was trying to setup Troll on my local (windows 7) machine and ran into errors when running compile.bat. I installed MoscowML fine, however, it is having problems compiling script. Firt prob is with mosmllex there is no mosmllex.exe in the bin folder, only a bare mosmllex file in the lib folder. Any help you can offer?

Here is my console output:

λ compile.bat

mosmlyac -v Parser.grm

mosmllex Lexer.lex
'mosmllex' is not recognized as an internal or external command,
operable program or batch file.

mosmlc -c Syntax.sml

mosmlc -c Parser.sig
File "parser.sig", line 1-142, characters 0-3333:
! local
! type t1_ = (int*int)
! type t2_ = (int*int)
! type t3_ = (int*int)
! ..........
!  | VCONCR of t67_
!  | WHILE of t68_
!  | Z of t69_
! end..
! Compliance Warning:
! The phrase is an instance of the Moscow ML extension:
!  <spec> ::= local <spec> in <spec> end
! which is not supported by the Definition of Standard ML.

mosmlc -c Parser.sml

mosmlc -c Lexer.sml
! I/O operation failed: Nonstdio.openinbin on lexer.sml

mosmlc -c Interpreter.sig

mosmlc -c Interpreter.sml

mosmlc -c Rescope.sml

mosmlc -c Distribution.sig

mosmlc -c Distribution.sml

mosmlc -o troll.exe Main.sml
File "main.sml", line 155, characters 44-55:
!              val (decls,exp) = Parser.Dice Lexer.Token lexbuf
!                                            ^
! Cannot find file Lexer.ui


Fri Jan 15 02:29:54 2016   by   Razorfire
Quick Update

After a bit more research I found an older version of MoscowML with a mosmmlex.exe that i got working. So have things working now. Thanks.
Thu Mar 18 17:15:04 2021   by   k3rmit
I'm trying to compile this under Win10 and getting the exact same result as posted above (except 'File "parser.sig", line 1-146, characters 0-3428' because probably newer version of Troll).

I am using "MosML og emacs version 2.013" installed from the EXE posted in the link at the bottom of

Any idea which version of MoscowML was used by Razorfire to get this working? Or another suggestion to be able to run Troll locally under Win10?

Thank you!
Thu Mar 18 18:06:19 2021   by   k3rmit
Found it. Uninstalled 2.013 and installed "Moscow ML 2.01" from EXE found here:

Now compile.bat runs correctly and I have a troll.exe generated.

Unfortunately I'm not smart enough to figure out multi-line shell syntax for Windows. Wants to execute right away... Hopefully the internet will have my answers somewhere.
Thu Mar 18 18:27:39 2021   by   k3rmit
The saga continues. I don't think it's a command-line syntax error after all. I tried running this single line command:
> troll test.t

...where test.t is a text file in the same directory as troll.exe and has one line in it (2d6) and I still get the same error. The error is:

Uncaught exception:

Perhaps the troll.exe didn't compile as nicely as I thought? Any ideas?
Mon Mar 22 10:11:48 2021   by   Torben
I will look into it.  I'm not using Windows myself, so I haven't encountered this issue.
Mon Mar 22 12:30:09 2021   by   Torben
Try installing Moscow ML from instead of from Peter Sestofts page.  There is a windows installer.
Sun Mar 28 21:35:29 2021   by   k3rmit
Hi Torben,

Thanks for the reply and suggestion. Unfortunately, the windows installer link from is 404.

I was hoping to run a probability distribution of a full combat (expected number of rounds until victory) and 99 iterations wasn't deep enough for some scenarios. So I was looking into the standalone version.

Still on the website this is a super useful tool. Thank you for keeping it alive!
Mon Mar 29 10:08:35 2021   by   Torben
I know the maintainer of, and have sent an error report to him. So, hopefully, the problem will be fixed soon.
Fri Apr 23 14:17:30 2021   by   Torben
The maintainer sent me this link:

The reason for the 404 error is that GitHub took the installer down because a virus checker said it was malware (it's not!).
Fri Jul 16 20:56:54 2021   by   Scarbrow
The maintainer link you've shared doesn't seem to work. Github page is unchanged too. Could you please try to speak with him again?
Mon Aug 9 16:02:56 2021   by   Torben
The correct link is

The missing tilde was due to how the message system on this page formats text (~ is used as an escape character).  Sorry about that.
Wed Aug 11 14:19:40 2021   by   Scarbrow
I found it!!

First, thank you for the link. With it, I've been able to confirm it's the same file, bit by bit, than the one suggested at Thus, that installer is missing the mosmllex binary too.

However, by browsing other Github issues, I was able to find I cite: "When cross-compiling Moscow ML for Windows, mosmllex is left in two parts: header.exe and mosmllex. The old .w32 Makefile suggests that this is fixed by concatenating the two files into mosmllex.exe", and below: "Due to this issue, the official Windows binary distribution of 2.10.1 lacks mosmllex."

After understanding this, the solution was clear:
1) Download from this site, unzip it somewhere. Download MoscowML from either GitHub issue link or the link provided by Torben. Install MoscowML.
1) If you've installed MoscowML on default location, C:\Program Files (x86)\mosml\bin, you won't be able to create files there unless you're an admin, so open an elevated command prompt.
2) cd C:\Program Files (x86)\mosml\lib\mosml to reach the broken files
3) type header mosmllex > ../../bin/mosmllex.exe to merge them, creating the missing executable
4) Execute compile.bat (from Now it will compile cleanly.

However possible is this, I would please request from you that you plead with the maintainer of the MoscowML binary, so he either fixes the problem that doesn't finish merging mosmllex.exe, or makes the binary available somehow on Github. This is way above the technical level of the median user, even with the commands spelt out here.
Wed Aug 11 14:21:15 2021   by   Scarbrow
The previous links won't work because the final dot (.) shouldn't be part of the link. Sorry.

Return to topic list

New message:
Posted by:

Type the values of the dice shown below:

Return to topic list