Git Product home page Git Product logo

tsll's Introduction

Actions Status npm version

What is tsll?

Tsll 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.

Design idea

Tsll extracts information on Abstract Syntax Tree (AST) generated with Typescript Compiler API by visiting each node, and create instructions accordingly with LLVM Typescript bindings to achieve the final IR generation.

For more detail, go to wiki pages

Prerequisite

Follow the steps to build the source code in LLVM project. I highly recommend using the build tool Ninja as it is fast and simple. Below are a few steps you could start from.

  1. Clone the LLVM project repository and enter the project directory via git clone https://github.com/llvm/llvm-project.git and cd llvm-project
  2. Choose a tag from the list and check out into a branch by running git tag -l and git checkout tags/<tag> (Replace <tag> for with your tag choice)
  3. Generate Ninja build files with cmake -S llvm -B build -G Ninja
  4. cmake --build build to start building your LLVM from the Ninja build files (This may take a while)

Note 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.

Install

npm install tsll

Usage

tsll can be run as a command as you normally would. Just type the following command to see more options on your favorite terminal.

tsll -h

Development

For those who would like to develop this project together, please check out below.

git clone this repo, and make sure you have already installed LLVM before npm i.

Code Style

This project is developed generally with Typescript style guide to attain better maintainability and readability.

Project Structure

All 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.

References

A 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.

Disclaimer

By using this project, you agree that we as SBIP developers of tsll have no legal obligations in any form to your usage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.