ASDAlexander77/TypeScriptCompiler
À propos
Un compilateur natif AOT (anticipé) et JIT pour TypeScript, basé sur LLVM/MLIR. Il compile directement les fichiers .ts en exécutables natifs ou en WebAssembly, ou les exécute à la volée grâce à un JIT intégré, sans nécessiter Node.js ni environnement d’exécution JavaScript.
Langages et environnements d’exécutionProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- +3
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalTypeScript Native Compiler
A native ahead-of-time (AOT) and JIT compiler for TypeScript, built on LLVM/MLIR.
It compiles .ts files directly to native executables, shared libraries and WebAssembly, or runs
them on the fly via a built-in JIT — no Node.js or JavaScript runtime required.
Targets: Windows, Linux, Android (arm64-v8a, armeabi-v7a, x86_64), WebAssembly (wasm32, wasm64).
Contents
- Quick start
- Memory models
- Documentation
- Showcase: native_ts_graphics
- Community · License · Contributing
Quick start
Download tslang from Releases,
or try it on Compiler Explorer.
File hello.ts:
function main() {
print("Hello World!");
}
Run it with the JIT:
tslang hello.ts
Or compile it to an executable (on Linux add --relocation-model=pic):
tslang --emit=exe hello.ts
hello.exe
Hello World!
Start a new project:
tslang --new Test1
creates a Visual Studio Code project, and
tslang --cmake Test1
a CMake project for mixed C++/TypeScript (see What's new for building it).
More in Running and compiling programs: a larger example, the JIT cache, debugging JIT code with GDB, and the environment variables the linker uses.
Memory models
How heap memory is managed is selected with -mm=:
| flag | ||
|---|---|---|
-mm=gc |
garbage collection (Boehm) | the default |
-mm=rc |
reference counting - freed as soon as the last reference goes, no collector, no libgc |
does not collect reference cycles |
-mm=none |
nothing is ever freed | short-lived programs |
-mm=own |
single ownership inferred at compile time, like Rust's borrow checker - no collector, no counting | in development; ownership that cannot be proven is a compile error |
See memory-models.md and the -mm=own guide.
Under -mm=own tslang runs within 1.1-1.4x of idiomatic Rust on an object-heavy ray tracer and on
par with it on array loops — see Performance.
Documentation
| Topic | Page |
|---|---|
| Running with the JIT, compiling executables, debugging JIT code | docs/running.md |
| Android: cross-compiling and building the runtime libraries | docs/android.md |
| WebAssembly | docs/wasm.md |
Memory models (gc, rc, none) |
docs/memory-models.md |
The -mm=own single-owner model |
docs/own-memory-model.md |
How ready -mm=own is |
docs/own-readiness.md |
| Benchmarks against Rust and C++ | docs/performance.md |
C and C++ bindings with tsbindgen |
docs/tsbindgen.md |
Calling C++ classes (@cpp) |
docs/cpp-classes.md |
JSX in .tsx files: elements as calls of your own factory |
docs/jsx.md |
GPU kernels (@kernel, gpuLaunch) on NVIDIA, AMD and Intel GPUs |
docs/gpu.md |
| Building the compiler from source | docs/building.md |
| What's new and roadmap | docs/whats-new.md |
| JavaScript built-in objects library | Default Library repo |
| How-to guides and more | Wiki |
Showcase: native_ts_graphics
native_ts_graphics is a set of 25
real-time 3D graphics samples — TypeScript ports of NVIDIA's Donut
samples on Direct3D 12 and Vulkan, from basic_triangle to ray tracing, meshlets and work
graphs — compiled to native code with tslang. .ts files are a first-class CMake language
(TSLANG) linked with the C++ framework through a C interop layer, and the samples run on
Windows and Android.
Community
- GitHub Discussions (preferred)
(legacy)
License
This project is licensed under the MIT License — see the LICENSE file for details.
Contributing
Issues and pull requests are welcome. See the Wiki for documentation, build notes, and how-to guides.
Explorer des projets similaires
Chargement…
