{"id":17372707,"url":"https://github.com/sbip-sg/tsll","last_synced_at":"2025-04-15T05:51:28.587Z","repository":{"id":43341494,"uuid":"413391553","full_name":"sbip-sg/tsll","owner":"sbip-sg","description":"Tsll is a Typescript-to-LLVM-IR compiler frontend authored by Singapore Blockchain Innovation Programme (SBIP).","archived":false,"fork":false,"pushed_at":"2022-03-07T08:26:07.000Z","size":1176,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-16T05:32:32.923Z","etag":null,"topics":["compiler","compiler-frontend","llvm","llvm-ir","typescript","typescript-compiler"],"latest_commit_sha":null,"homepage":"https://www.comp.nus.edu.sg/~dbsystem/discover","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbip-sg.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":"2021-10-04T11:25:22.000Z","updated_at":"2024-09-14T18:23:46.000Z","dependencies_parsed_at":"2022-09-02T17:15:05.583Z","dependency_job_id":null,"html_url":"https://github.com/sbip-sg/tsll","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbip-sg%2Ftsll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbip-sg%2Ftsll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbip-sg%2Ftsll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbip-sg%2Ftsll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbip-sg","download_url":"https://codeload.github.com/sbip-sg/tsll/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016315,"owners_count":21198832,"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","compiler-frontend","llvm","llvm-ir","typescript","typescript-compiler"],"created_at":"2024-10-16T02:03:34.763Z","updated_at":"2025-04-15T05:51:28.563Z","avatar_url":"https://github.com/sbip-sg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/sbip-sg/tsll/workflows/CI/badge.svg)](https://github.com/sbip-sg/tsll/actions)\n[![npm version](https://badge.fury.io/js/tsll.svg)](https://badge.fury.io/js/tsll)\n## What is tsll?\nTsll is a Typescript compiler frontend for LLVM IR generation. Our goal of this work is to verify blockchain smart contracts through the generated IR. Before we transpile Node.js code in Typescript into Javascript artifacts, tsll combined with other backend analysis tools could provide a powerful framework to search for vulnerabilities and security issues as smart contract developers would not realize while writing such smart contracts.\n\n#### **Design idea**\nTsll extracts information on Abstract Syntax Tree (AST) generated with [Typescript Compiler API](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API) by visiting each node, and create instructions accordingly with [LLVM Typescript bindings](https://github.com/sbip-sg/llvm-node) to achieve the final IR generation.\n\nFor more detail, go to [wiki pages](https://github.com/sbip-sg/tsll/wiki)\n\n## **Prerequisite**\nFollow the steps to build the source code in [LLVM project](https://github.com/llvm/llvm-project). I highly recommend using the build tool [Ninja](https://ninja-build.org/) as it is fast and simple. Below are a few steps you could start from.\n\n1. Clone the LLVM project repository and enter the project  directory via\n`git clone https://github.com/llvm/llvm-project.git` and\n`cd llvm-project`\n2. Choose a tag from the list and check out into a branch by running `git tag -l` and `git checkout tags/\u003ctag\u003e` (Replace `\u003ctag\u003e` for with your tag choice)\n3. Generate Ninja build files with `cmake -S llvm -B build -G Ninja`\n4. `cmake --build build` to start building your LLVM from the Ninja build files (This may take a while)\n\nNote that we use LLVM 13.0.0 to convert Typescript to LLVM Intermediate Representation in this project so you might want to build this LLVM version for compatibility purposes.\n\n## Install\n```\nnpm install tsll\n```\n## Usage\ntsll can be run as a command as you normally would. Just type the following command to see more options on your favorite terminal.\n```\ntsll -h\n```\n## Development\nFor those who would like to develop this project together, please check out below.\n\n`git clone` this repo, and make sure you have already installed LLVM before `npm i`.\n\n## Code Style\nThis project is developed generally with [Typescript style guide](https://google.github.io/styleguide/tsguide.html) to attain better maintainability and readability.\n\n## Project Structure\nAll of the code is located in the **src** directory. Under **src/core** are the core components **Visitor**, **Builder**, and **Debugger** included. These three pillars are combined with the common utilites under **src/common** for Tsll to work as a compiler frontend. **src/cli.ts** and **src/converter.ts** are basically the entry point to the compiler.\n\n## References\nA list of resources regarding LLVM and Typescript Compiler API documentation is provided below so that you can get started with this project to contribute if you will.\n- https://github.com/microsoft/TypeScript/blob/d8e830d132a464ec63fd122ec50b1bb1781d16b7/doc/spec-ARCHIVED.md\n- https://releases.llvm.org/11.0.0/docs/LangRef.html\n- https://ts-ast-viewer.com/#\n- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference\n- https://github.com/emlai/ts-llvm\n\n## Disclaimer\nBy using this project, you agree that we as SBIP developers of tsll have no legal obligations in any form to your usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbip-sg%2Ftsll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbip-sg%2Ftsll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbip-sg%2Ftsll/lists"}