The unofficial JavaScript (subset) to Z-machine compiler.
Using npm
npm i -g npm
npm i -g zorkscript
Invoke the compiler from the command line...
zsc in.js --out out.z3
...and run the output in an appropriate Z-Machine intepreter, such as Frotz. Binaries are available for (Windows, iPhone, Ubuntu, etc)
An example
const max = 50;
const sieve = Array(51);
// https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
function printPrimes() {
for (let i = 2; i <= max; ++i) {
const isMarked = loadb(sieve, i);
if (isMarked != true) {
print(' '); print(i);
for (let j = i * 2; j <= max; j += i) {
storeb(sieve, j, 1);
}
}
}
}
print('primes: '); printPrimes(); print('\n');