{"id":13802245,"url":"https://github.com/01alchemist/TurboScript","last_synced_at":"2025-05-13T13:30:38.050Z","repository":{"id":57382280,"uuid":"76457625","full_name":"01alchemist/TurboScript","owner":"01alchemist","description":"Super charged typed JavaScript dialect for parallel programming which compiles to WebAssembly","archived":true,"fork":false,"pushed_at":"2017-09-08T07:16:30.000Z","size":13796,"stargazers_count":497,"open_issues_count":28,"forks_count":35,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-17T22:07:49.404Z","etag":null,"topics":["compiler","javascript","parallel-computing","typescript","webassembly"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/01alchemist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-14T12:27:18.000Z","updated_at":"2025-04-12T04:33:22.000Z","dependencies_parsed_at":"2022-09-13T03:01:51.124Z","dependency_job_id":null,"html_url":"https://github.com/01alchemist/TurboScript","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FTurboScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FTurboScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FTurboScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/01alchemist%2FTurboScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/01alchemist","download_url":"https://codeload.github.com/01alchemist/TurboScript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253949933,"owners_count":21989273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","javascript","parallel-computing","typescript","webassembly"],"created_at":"2024-08-04T00:01:40.110Z","updated_at":"2025-05-13T13:30:35.601Z","avatar_url":"https://github.com/01alchemist.png","language":"JavaScript","readme":"# TurboScript\n[![Build Status](https://travis-ci.org/01alchemist/TurboScript.svg?branch=master)](https://travis-ci.org/01alchemist/TurboScript) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/01alchemist/TurboScript?branch=master\u0026svg=true)]() [![Stories in Ready](https://badge.waffle.io/01alchemist/TurboScript.png?label=ready\u0026title=Ready)](https://waffle.io/01alchemist/TurboScript) [![Greenkeeper badge](https://badges.greenkeeper.io/01alchemist/TurboScript.svg)](https://greenkeeper.io/)\n\nSuper charged typed JavaScript dialect for parallel programming which compiles to WebAssembly\n\n# :warning: Major re-architecting is undergoing.\nNew spec (WIP) : [TurboScript Spec](https://github.com/TurboScriptLang/spec/blob/master/spec.md)\n## Things going to change \n* ### Binaryen as WebAssembly Backend\n* ### Interop with TypeScript/JavaScript (Import well typed TypeScript to TurboScript, will not compile to WASM)\n* ### Import any compiled WASM module to TurboScript\n* ### Integration with WebPack\n\n[![Throughput Graph](https://graphs.waffle.io/01alchemist/TurboScript/throughput.svg)](https://waffle.io/01alchemist/TurboScript/metrics/throughput)\n\n\u003cpre\u003e\n    @             _________\n     \\____       /         \\\n     /    \\     /   ____    \\\n     \\_    \\   /   /    \\    \\\n       \\    \\ (    \\__/  )    )          ________  _____  ___  ____\n        \\    \\_\\ \\______/    /          /_  __/ / / / _ \\/ _ )/ __ \\\n         \\      \\           /___         / / / /_/ / , _/ _  / /_/ /\n          \\______\\_________/____\"-_____ /_/  \\____/_/|_/____/\\____/\n\u003c/pre\u003e\n\nTurboScript 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.\n\nThis 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.\n\n## [Try online](https://maxgraey.github.io/Assembleash/#TurboScript)\n\n## Install\n`npm install -g turboscript`\n\n## Types\nType      | Native type | Description\n----------|-------------|-------------\n`int8`   | i32         | An 8-bit signed integer.\n`uint8`    | i32         | An 8-bit unsigned integer.\n`int16`   | i32         | A 16-bit signed integer.\n`uint16`  | i32         | A 16-bit unsigned integer.\n`int32`     | i32         | A 32-bit signed integer.\n`uint32`    | i32         | A 32-bit unsigned integer.\n`int64`    | i64         | A 64-bit signed integer.\n`uint64`   | i64         | A 64-bit unsigned integer.\n`boolean`    | i32         | A 1-bit unsigned integer.\n`float32`   | f32         | A 32-bit floating point number.\n`float64`  | f64         | A 64-bit floating point number.\n`void`    | none        | No return type.\n`string`    | *        | A utf-8 encoded textual data type.\n`Array\u003cT\u003e`    | *        | A generic array data type.\n\n## Syntax\n\n### variables\n```typescript\nvar myGlobal:int32 = 1;\nlet evaluatedVar:int32 = myGlobal + 1;\n// let is same as var.\n```\n\n### Number Literals\n```typescript\nlet integer:int32 = 1234;\nlet integer64bit:int64 = 1234;\nlet floatingPoint:float32 = 1.234f;\nlet floatingPoint64bit:float64 = 1.234; // default floating point number is 64 bit\n\n// You can also omit type since compiler infer type from the literal\nlet integer = 1234; // default integer is 32 bit, use type :int64 for 64 bit integer \nlet floatingPoint = 1.234f;\nlet floatingPoint64bit = 1.234;\n```\n\n### function\n```typescript\n// add.tbs\nexport function add(a:int32, b:int32):int32 {\n    return a + b;\n}\n```\n\n### class\n```typescript\n// vector3D.tbs\nexport class Vector3D {\n    x:float32;\n    y:float32;\n    z:float32;\n\n    constructor(x:float32, y:float32, z:float32){\n        this.x = x;\n        this.y = y;\n        this.z = z;\n    }\n}\n```\n\n### Generic\n```typescript\nclass Foo\u003cT\u003e {\n    value:T;\n    constructor(value:T){\n        this.value = value;\n    }\n    getValue():T {\n        return this.value;\n    }\n}\n\nexport function testI32(value:int32):int32 {\n    let instance = new Foo\u003cint32\u003e(value);\n    return instance.getValue();\n}\n\nexport function testI64(value:int32):int32 {\n    let value2 = value as int64;\n    let instance = new Foo\u003cint64\u003e(value2);\n    return instance.getValue() as int32;\n}\n\nexport function testF32(value:float32):float32 {\n    let instance = new Foo\u003cfloat32\u003e(value);\n    return instance.getValue();\n}\n\nexport function testF64(value:float64):float64 {\n    let instance = new Foo\u003cfloat64\u003e(value);\n    return instance.getValue();\n}\n```\n\n### Operator overload\n```typescript\nclass Vector3D {\n    x:float32;\n    y:float32;\n    z:float32;\n\n    constructor(x:float32, y:float32, z:float32){\n        this.x = x;\n        this.y = y;\n        this.z = z;\n    }\n\n    operator + (other:Vector3D):Vector3D {\n        return new Vector3D(this.x + other.x, this.y + other.y, this.z + other.z);\n    }\n\n    operator - (other:Vector3D):Vector3D {\n        return new Vector3D(this.x - other.x, this.y - other.y, this.z - other.z);\n    }\n}\nexport function test():boolean {\n    let a = new Vector3D(1.0f,1.0f,1.0f);\n    let b = new Vector3D(1.0f,1.0f,1.0f);\n    let c = a + b;\n    return c.x == 2.0f \u0026\u0026 c.y == 2.0f \u0026\u0026 c.z == 2.0f;\n}\n```\n\n### Array\n```typescript\n// f64-array.tbs\nvar a: Array\u003cfloat64\u003e = null;\n\nexport function test(num:int32): Array\u003cfloat64\u003e {\n    a = new Array\u003cfloat64\u003e(num);\n    let i:int32 = 0;\n    while (i \u003c num) {\n        a[i] = 0.0;\n        i = i + 1;\n    }\n    return a;\n}\n\nexport function getArrayByteLength(value:Array\u003cfloat64\u003e):int32 {\n    return value.bytesLength;\n}\nexport function getArrayElementSize(value:Array\u003cfloat64\u003e):int32 {\n    return value.elementSize;\n}\n\nexport function getArray(): Array\u003cfloat64\u003e {\n    return a;\n}\nexport function getData(index:int32):float64 {\n    return a[index];\n}\nexport function setData(index:int32, value:float64):void {\n    a[index] = value;\n}\n\n```\n\n#### Compile to wasm\n`tc add.tbs --wasm --out add.wasm`\n\n## Join ![Slack](https://01alchemist.com/images/slack-logo-small.png)\nYou need an invitation to join Slack. Open a ticket with your email address. I will make it happen.\n\n# Roadmap\n\n* ~~Parallel JavaScript~~\n* ~~WebAssembly Emitter~~\n* ~~Basic malloc and free~~\n* ~~ASM.JS Emitter~~\n* ~~Import external functions with namespace~~\n* ~~Array Data Type~~\n* Parallel WebAssembly (post-MVP)\n\n# Wiki\nDocumentations can be found at [wiki](../../wiki) (under construction :construction:)\n\n# Useful links\n* [Future WebHPC \u0026 Parallel Programming with JavaScript](https://dump.01alchemist.com/2016/12/31/future-webhpc-parallel-programming-with-javascript-the-new-era-about-to-begin/)\n* [TurboScript playground](https://01alchemist.com/projects/turboscript/playground/)\n* [Assembleash playground](https://github.com/MaxGraey/Assembleash/#TurboScript)\n\n\n# Credit\nLexical analysis, Parsing, Checking codes are borrowed from Evan Wallace's thinscript\n\n# Now enjoy - Wow! this snail is fast\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=w-SDeBoDLTg\n\" target=\"_blank\"\u003e\u003cimg src=\"https://01alchemist.com/images/Turbo-630x354.jpg\"\nalt=\"Wow! this snail is fast\" width=\"630\" height=\"354\" border=\"10\" /\u003e\u003c/a\u003e\n","funding_links":[],"categories":["Languages"],"sub_categories":["JavaScript-family"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01alchemist%2FTurboScript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F01alchemist%2FTurboScript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F01alchemist%2FTurboScript/lists"}