{"id":13435008,"url":"https://github.com/evanw/thinscript","last_synced_at":"2025-04-12T22:29:34.475Z","repository":{"id":50741731,"uuid":"54457888","full_name":"evanw/thinscript","owner":"evanw","description":"A low-level programming language inspired by TypeScript","archived":false,"fork":false,"pushed_at":"2016-05-11T17:12:56.000Z","size":1736,"stargazers_count":1368,"open_issues_count":8,"forks_count":49,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-04-04T01:39:24.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://evanw.github.io/thinscript/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evanw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-22T08:26:09.000Z","updated_at":"2025-02-26T19:06:00.000Z","dependencies_parsed_at":"2022-08-12T22:10:34.993Z","dependency_job_id":null,"html_url":"https://github.com/evanw/thinscript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fthinscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fthinscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fthinscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evanw%2Fthinscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evanw","download_url":"https://codeload.github.com/evanw/thinscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248639477,"owners_count":21137848,"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":[],"created_at":"2024-07-31T03:00:30.105Z","updated_at":"2025-04-12T22:29:34.455Z","avatar_url":"https://github.com/evanw.png","language":"C","readme":"# ThinScript\n\nThinScript is an experimental programming language that compiles to JavaScript, WebAssembly, and C.\nIt's meant to be a thin layer on top of WebAssembly that makes it easier to work with: no dependencies and fast compile times.\nThe syntax is inspired by TypeScript and the compiler is open source and bootstrapped (it can compile itself).\n\nThis is still an experiment and isn't intended for real use yet.\nThe biggest issue is that the generated code currently doesn't delete anything (garbage collection is planned but not yet implemented).\nAlso the WebAssembly specification is still being developed and the current binary format will stop working when WebAssembly is officially released.\n\n## Demo\n\nAn interactive compiler demo is available online at http://evanw.github.io/thinscript/.\nHere's some example code to demonstrate the language (documentation will be written at some point):\n\n```TypeScript\ndeclare function print(text: string): void;\n\nclass Link {\n  value: int;\n  next: Link;\n}\n\nclass List {\n  first: Link;\n  last: Link;\n\n  append(value: int): void {\n    var link = new Link();\n    link.value = value;\n\n    // Append the new link to the end of the chain\n    if (this.first == null) this.first = link;\n    else this.last.next = link;\n    this.last = link;\n  }\n}\n\nextern function main(): int {\n  var list = new List();\n  list.append(1);\n  list.append(2);\n  list.append(3);\n\n  var total = 0;\n  var link = list.first;\n  while (link != null) {\n    total = total + link.value;\n    link = link.next;\n  }\n\n  #if JS\n    print(\"Hello from JavaScript\");\n  #elif WASM\n    print(\"Hello from WebAssembly\");\n  #elif C\n    print(\"Hello from C\");\n  #else\n    print(\"Unknown target\");\n  #endif\n\n  return total;\n}\n```\n\n# Building\n\nRun `node build.js` to build the compiler using itself.\nThis generates updated versions of `out/compiled.js`, `out/compiled.wasm`, and `out/compiled.c`.\nIf you have a C compiler installed, this also builds a native version of the compiler by compiling `out/compiled.c` and `lib/thinc.c` together into the `out/thinc` binary.\n","funding_links":[],"categories":["C","未来会研究的","Other"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanw%2Fthinscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevanw%2Fthinscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevanw%2Fthinscript/lists"}