Git Product home page Git Product logo

tan's Introduction

tan programming language

codecov

Work In Progress

tan has been my hobby project for several years now. It helped me tremendously on understanding how compilers work, how large-scale software is structured (I read a lot of LLVM source code LOL), and how programming languages are designed. It will become a playground for me to work on interesting language designs. Needless to say, the design is never intended to be "better than xxx language".

I currently want it to:

  • Adapt some modern syntax
  • Support writing less painful and verbose OOP
  • Have strong and interesting meta-programming mechanism
  • Steal design from other languages such as Zig, Rust, Carbon, Python, C#, D, ...

Quickstart

A Quick Peek

See *.tan files under test/test_exec for some examples.

Prerequisites

  • Make sure to clone this repository using git clone --recursive, see submodules under dep/
  • CMake >=3.19
  • LLVM 15 tools and development libraries
  • See Dockerfile for a full list of dependencies

Building and Testing

tan uses CMake as its build system. Run the following command in project root directory to build and run all tests.

mkdir -p build
cd build
cmake ..
make tests

Platforms

Platform Status Note
Linux ✔️ Only tested on Ubuntu 20.04 for now
Windows Build successfully, but clang doesn't run correctly on my machine
Mac I don't have a mac. Mac is for superior people

CMake options

  • ENABLE_COVERAGE: bool, Enable test coverage, default OFF
  • BUILD_EXAMPLES: bool, Build tan examples, default OFF
  • ENABLE_CCACHE: bool, Enable ccache to speed up rebuilding, default ON
  • LLVM_ROOT_DIR: Custom LLVM location
  • CLANG_ROOT_DIR: Custom CLANG location
  • LLD_ROOT_DIR: Custom CLANG location

Documentation

Doxygen https://tjysdsg.github.io/tan/html/index.html
Some markdown files in the source code Search under src

Project Structure

  • dep: third-party dependencies
  • docs: documentations generated by Doxygen
  • examples: example programs written in tan and C
  • fuzzing: tools for fuzz testing, not updated for a long time
  • include: public headers
  • runtime: tan runtime source files (a mix of tan and C++)
  • scripts: utility scripts
  • src: source files
    • analysis: code analysis and type checking
    • ast: Abstract Syntax Tree
    • backtrace: wrapper around libbacktrace
    • base: should be named core loll
    • cli: commandline interface of tanc compiler
    • codegen: LLVM IR and binary object generation
    • compiler: compiler driver
    • lexer: lexer
    • linker: linker implemented using clang frontend
    • llvm_api: API wrappers for LLVM and clang
    • parser: A hand-written parser
    • source_file: Classes related to representing source files and text tokens
  • test: unittests and system tests (mostly system tests)
    • test_exec: executable compilation tests
    • test_lib: library compilation tests
    • Some other unittests

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.