BuildAndInstallation
The original Flatscript compiler was written in C++. After the fundamental functionalities of the language implemented, the self-hosting was started and now Flatscript is implemented in Flatscript itself.
The last C++ version is saved in the "cpp-legacy" branch in this repository, but not updated after Flatscript v0.1.0, which is the first version uploaded to npm. As a result, it is hard to build the compiler from nothing.
So, we suggest to install the compiler by npm
npm install -g flatscript
and use the compiler to compile Flatscript, if you would like to contribute.
After install the bootstrapper, you could build the compiler at the root of Flatscript source directory by
make
or if you want to build the compiler recursively (compile the source by the compiler that is newly built)
make recursive
The mocha library is needed to run unit-tests.
Run
make runtest
after the compiler is built. Or
make recursivetest
to test the compiler that is generated recursively.
Please use Flatscript. No JS file is allowed. (*.js
is added to gitignore)
Modules
-
parse/
lexicial and syntactical analysis, and simple syntax transformation -
resolve/
name-lookup, compile-time constant folding, and syntax transformation for regular asynchronous transformation -
backend/
JS output -
main.fls
program entry, with opt parsing -
compiler.fls
compiling control and error output -
globals.fls
global configuration -
errors.fls
compiling error classes
Use
make npm
to generate package.json
.