Scriptol to WebAssembly compiler
To make wasm files that can be used on the web or locally.
How it works ?
The compiler only needs a single command line to generate C ++ code and compile it into WebAssembly. For example:
./solc hello
This produces the hello.cpp, hello.hpp, hello.o, and hello.wasm files.
You need to install Emscriptem to generate the wasm code and Wasmer to run it from the command line.
On Windows, the latter requires the installation of Visual Studio. It is also necessary to install from this one the components of use of C ++ in command line.
Options
- -h
Generate a wasm, js and html files. - -l
Generate a wasm file to load inside a web page or to be used locally from another program with node.js - -r
Compile the scriptol source if needed into wasm and locally run the wasm program. - -b
Compiles all scriptol and C++ sources. - -c
Compiles only scriptol sources to C++. - -w
Compiles C++ files without compiling scriptol sources. This allows to change C++ files for testing. - -v
Displays all stages of processing. - -q
Perform a compilation without displaying any message.
Why use Scriptol rather than C++ directly?
- Scriptol does not need a makefile, we just give the name of the main source file.
- No need to write header files (except for external libraries).
- In C ++, the instructions are also expressions and a line like: if (a = 10) means that 10 is assigned to the variable a and the contents of a compared to zero, rather ambiguous ...
- A clear syntax, that of C is over 30 years old!
- Completely object oriented, variables and literals are methods.
- Araay whose size can increase ze during processing.
- Associative arrays.
- Dynamic variables.
- Unnecessary semicolons, a line like while (i <10); producing an endless loop cannot happen by mistake.
- More advanced control structures.