Am 16.07.2013 23:34, schrieb Mark Morgan Lloyd:
Mattias Gaertner wrote:
On Tue, 16 Jul 2013 19:19:34 +0000
Mark Morgan Lloyd <markmll.laza...@telemetry.co.uk> wrote:

[...]asm.js has strictly numeric types,

yes

so you can't write a conventional "Hello, World!" in it.

There are javascript libraries implementing strings via arrays.

Yes, but asm.js is usually used as an intermediate language akin to Java bytecodes. cf Emscripten etc.

Nevertheless you are free to call normal JS code without problems. asm.js is a subset of JS after all. How do you think the emscripten libraries are implemented? asm.js can run on any JS interpreter that supports a certain JS standard. The only difference is that interpreters with special support for asm.js can optimize that code more than usual JS code. Also CPUs don't know strings either, nevertheless you can see them on your screen. It's all about interpreting the memory in the correct way and writing to the correct location.


If you want to do that, then you have to write it in a suitable high-level language: I suggested Javascript, but I can see how that could be confusing so let's just accept /anything/ here.

Now if something like that can't, ultimately, be run from a shell or a makefile it's going to be problematic for an FPC port.

When I google for "asm.js command line tool" then the first hit is the
SpiderMonkey engine. Do you mean that?

As I understand it, SpiderMonkey is for embedding Javascript in a (GUI-based) program, rather than for executing a Javascript or asm.js program from the command line (or from a makefile etc.) and getting text output.

For example, this (via Google) https://github.com/benjcooley/asm-js-firefox-test/blob/master/compile-hello-world.sh shows a "Hello, World" in C++ being compiled using Emscripten, but the target is an HTML file rather than something that could be run from a shell or makefile.

[Later] Something like Rhino Shell might do the job. Possibly others.

Please read the tutorial of emscripten as it explains how to run a JS/asm.js program on the command line: https://github.com/kripken/emscripten/wiki/Tutorial

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to