Notice: This project is not being actively worked on. If you're interested to pick it up, let me know. See #12.
It uses the TypeScript Compiler
parse and typecheck the input TypeScript code. The resulting TypeScript AST is
transformed into LLVM IR using the
llvm-node bindings. ts-llvm also
provides a runtime library written in C++ that implements native replacements
for built-in TypeScript APIs such as
ts-llvm is still in very early stages of development. For example, it cannot yet compile most TypeScript programs and it doesn't yet do any garbage collection. If you're willing to contribute, any help will be greatly appreciated. For questions you can create a GitHub issue or ask on the ts-llvm Slack.
npm installto install other dependencies. If llvm-config is not on your PATH, you may need to tell llvm-node where to find LLVM on your system, e.g. by running
npm config set cmake_LLVM_DIR $(path-to-llvm/bin/llvm-config --cmakedir)before
g++(any C++ compiler) on your PATH.
llcwill not be required once llvm-node gains support for the LLVM legacy PassManager and addPassesToEmitFile APIs.
g++will not be required once ts-llvm learns to detect the system C++ compiler on its own.
Once everything above is set up, you can use the following commands:
npm run buildwill build the ts-llvm compiler in the
npm startwill run the ts-llvm compiler. You can pass arguments to the compiler after two consecutive hyphens: e.g.
npm start -- --helpwill print the compiler's usage information.
npm testwill run the test suite. ts-llvm uses snapshot testing to test the output LLVM IR code. Use
npm run updateSnapshotsto update the snapshot files.
ts-llvm is licensed under the MIT license.