Well, guess what - in Oct of last year, a project appeared called emscripten that will do just that for C/C++. So without further ado, let's convert the InChI code.
Actually, maybe it'd make more sense to begin with "Hello World":
#include <stdio.h>To start with, compile llvm, clang, spidermonkey and v8 as described in the install instructions.
#!/bin/shAfter some trivial edits to the code, we can run hello.js in the browser.
$LLVM_BINDIR/clang hello.c -o hello
$LLVM_BINDIR/clang hello.c -S -emit-llvm
$LLVM_BINDIR/llvm-dis hello.s.bc -show-annotations
# Run emscripten
$EMSCRIPTEN/emscripten.py hello.s.ll $V8/d8 > hello.js
Part II shows my attempt to repeat this procedure with the InChI code.