Emscripten is a source-to-source compiler (Transpiler), that transforms LLVM bytecode, typically created by compiling from C or C++, to JavaScript. It produces a subset of JavaScript known as asm.js - wikipedia

As a result, native applications can be converted into JavaScript applications that can run in web browsers. Emscripten has been used to port, among other things, Unreal Engine 3, SQLite, and Bullet physics - github

asm.js can be compiled by browsers ahead of time meaning that the compiled programs can run much faster than those traditionally written in JavaScript.

So what would it take for Livecode to join this set of languages, all running in the browser, in an open source emulator:

  • Python
  • Ruby
  • PHP
  • Sceme
  • Lua
  • Java
  • Lolcode
  • Many others - repl.it

Here I can see how you can expose C functions:

  • http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html#calling-compiled-c-functions-from-javascript


Some examples include Unreal Engine 3, a fork of Cube Engine 2 known as BannanaBread, and ammo.js, which is an exact JavaScript port of the Bullet physics engine compiled using Emscripten.

An example of using the Emscripten C compiler:

emcc helloworld.c -o helloworld.html

An example of using a make file with Emscripten:

emmake make

An example of using a configure script with emscripten:

emconfigure ./configure


So my question would be how is this extended so that a handler in Livecode Builder is exposed?

Livecode Builder - being the robust strongly typed language that compilers like - lends to being something that could be run through the compiler chain you are creating to export Javascript.

For instance a Livecode Builder library - would be the sort of thing that could be compiled into a Javascript library that would then be called by standard HTML5/Javascript on a web page. This would be the same as emsripten ports of other languages like Ruby - github

The one thing I would like to understand is how you would expose interfaces to the resulting exported JS code - are there any links to how you would do this / any thoughts regarding how Livecode.js exports would do this?

# See also