Quick link to Mr. Srinivas's lessons about C. I can't thank this man enough for his awesome pedagogy and the fact he let it be free for everyone.
Namaste: the divine in me bows to the divine in you. भगवान आपको आशीर्वाद दे और आपको हमेशा संतुष्ट और खुश रखे. Thanks again sempai <3
- I)
sudo apt-get install gcc build-essential manpages-dev
- II) Write a
foo.c
file - III) Then in terminal :
gcc -Wall foo.c -o foo
(2) - IV) Run executable in terminal:
./foo
- I)
sudo apt-get install python2.7 cmake default-jre git-core
- II) Get emsdk
- III) Put this in your ~/.bashrc:
source $HOME/emsdk/emsdk_env.sh &> /dev/null
- IV) Return to the path of your
foo.c
- V)
emcc foo.c -s WASM=1 -o foo.html
(1) - VI) Example incoming
80% of good stuff is recensed here
Remaining 20% on Medium articles or Stack Overflow
WAT (WebAssemblyText, the human-readable version of WASM)
WASM GitHub
Awesome resource about awesome resources
AssemblyScript is for you: WASM without the hassle of learning a new language
Old (out of flavor since WASM) and unrelated, but imo it can still be interesting for JS devs trying to get closer to the machine.
While TypeScript is a superset of JavaScript, asm.js is a subset of it. Basically it works with only three data types:
- int: 32 bit integer type
- double: 64 bit floating point type
- float: 32 bit floating point type
So in the end your application is basically a giant JavaScript array of numbers and pointers to these numbers index. It should give +x% performance over typical, handwritten JS (guess it has to do with Big O and how CPU works, but if you're into this, please check the computer science resource above (& Google) instead of my word).
Afaik esm.js is not meant to be written by hand, but generated by compilers (Emscripten). Pretty much a precursor of WASM, I like what it does to JS, and the fact that it can still be written by hand.
But with the level of masochism involved, sane people better learn C and compile into asm.js (for fun) or WASM (for real).
"I am a bored 777 years old loli vampire and I want to proceed..." Np sis, go there, scroll down and enjoy the Japanese OC kudasai
asm.js official website
(1): Assuming you're in correct path. -Wall
will display all Warnings, foo.c
is target file, -o foo
will output an executable named foo
(2): foo.c
is target, -s
tells emcc to generate LLVM bitcode, WASM=1
WASM=true, -o foo.html
output an HTML file named foo (could also be foo.js
)