A C-like toy scripting language written in Typescript.
You can play around with the language in the CScript Editor.
- Stack-based intermediate-language
- Memory-safety
- Fast compilation times
- Strict type-checking
- Support for struct, array and 32-bit aligned primitive types — uint, int, and float
- Feature-rich, web-based editor
CScript is comprised of two components — the compiler and the interpreter.
The compiler is responsible for converting the C-like syntax to an intermediate language.
The interpreter is responsible for executing the intermediate language that is emitted by the compiler.
Note: Before building or testing, make sure you have Node installed.
To build the project:
- Type
npm i
- Type
npm run build
After the build process completes, the build/
directory will contain all the compiled JavaScript files and the build/editor/
directory will contain the web-packed compiler and interpreter JavaScript modules.
To run the tests for the project:
- Type
npm i
- Type
npm test
Currently, CScript has two limitations:
- The inability to move structs by value across function calls.
- The inability to move arrays by value across function calls.
The consequence is that struct and array types act as global static variables within functions.