You can write your web application in C language also!
This is simple demo using shared memory on both JavaScript and WebAssembly.
"WebAssembly test" (src on GitHub)
To set up WebAssembly to your Mac (taking 2 hours and 20GB storage space!!)
1. binaryen (compiler for WebAssembly)
cd *** git clone https://github.com/WebAssembly/binaryen.git cd binaryen cmake . && make
*** : your bin path
2. wabt (assembler for WebAssembly)
git clone --recursive https://github.com/WebAssembly/wabt cd wabt make cd ..
3. LLVM (takes long time and big storage space!)
git clone http://llvm.org/git/llvm.git cd llvm/tools git clone http://llvm.org/git/clang.git cd ../projects git clone http://llvm.org/git/compiler-rt cd ../.. mkdir llvmtmp cd llvmtmp cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly ../llvm make -j 8 sudo make install
4. edit PATH (.profile etc...)
export PATH=***/wabt/out/clang/Debug/:***/binaryen/bin/:$PATH
5. done! Let's make web an app in C!
#define SIZE 10 int mem[SIZE]; int* getMemory() { return mem; } int getMemorySize() { return SIZE; } int calc() { int sum = 0; for (int i = 0; i < SIZE; i++) { sum += mem[i]; } return sum; }