TurboScript
Super charged JavaScript for parallel programming and WebAssembly
@ _________ \____ / \ / \ / ____ \ \_ \ / / \ \ \ \ ( \__/ ) ) ________ _____ ___ ____ \ \_\ \______/ / /_ __/ / / / _ \/ _ )/ __ \ \ \ /___ / / / /_/ / , _/ _ / /_/ / \______\_________/____"-_____ /_/ \____/_/|_/____/\____/
TurboScript is an experimental programming language for parallel programming for web which compiles to JavaScript (asm.js) and WebAssembly (targeting post-MVP). The syntax is similar to TypeScript (Hardly trying to fill the gaps) and the compiler is open source and written in TypeScript. TurboScript has zero dependencies.
This is still an experiment and isn't intended for real use yet but we are working towards an MVP release. Please feel free to open issues if it stop working or need a new feature.
Try online
Install
npm install -g turboscript
Types
Type | Native type | Description |
---|---|---|
int8 |
i32 | An 8-bit signed integer. |
uint8 |
i32 | An 8-bit unsigned integer. |
int16 |
i32 | A 16-bit signed integer. |
uint16 |
i32 | A 16-bit unsigned integer. |
int32 |
i32 | A 32-bit signed integer. |
uint32 |
i32 | A 32-bit unsigned integer. |
int64 |
i64 | A 64-bit signed integer. |
uint64 |
i64 | A 64-bit unsigned integer. |
boolean |
i32 | A 1-bit unsigned integer. |
float32 |
f32 | A 32-bit floating point number. |
float64 |
f64 | A 64-bit floating point number. |
void |
none | No return type. |
string |
i32 | A utf-8 encoded textual data type. |
Array<T> |
i32 | A generic array data type. |
Syntax
variables
;;// let is same as var.
Number Literals
;;;; // default floating point number is 64 bit // You can also omit type since compiler infer type from the literal; // default integer is 32 bit, use type :int64 for 64 bit integer ;;
function
// add.tbs
class
// vector3D.tbs
Generic
Operator overload
Array
// f64-array.tbs;
Compile to wasm
tc add.tbs --wasm --out add.wasm
You need an invitation to join slack. open a ticket with your email address. I will make it happen.
Roadmap
Parallel JavaScriptWebAssembly EmitterBasic malloc and freeASM.JS EmitterImport external functions with namespaceArray Data Type- Parallel WebAssembly (post-MVP)
Wiki
Documentations can be found at wiki (under construction 🚧)
Useful links
Credit
Lexical analysis, Parsing, Checking codes are borrowed from Evan Wallace's thinscript