- Object-oriented programming
- Generics
- Safe memory management with smart pointers (unstable)
- Tagged/Discriminated union (Like Rust's enum)
- LLVM is adopted for backend
- Variable shadowing
- Elixir-like pipeline operator
- Pascal-like pointer syntax
See the examples and test/cases folders for actual program examples.
- LLVM (Confirmed to work with 13 and 14)
- Boost
- CMake
- Make (Anything that is supported by CMake)
- C++20 compiler
- GCC
Here is how to install them in ubuntu.
$ sudo apt update -yInstall GCC, Make and CMake.
$ sudo apt install -y build-essential cmakeInstall Boost 1.80.0.
$ sudo apt install -y g++ python-dev-is-python3 autotools-dev libicu-dev libbz2-dev wget
$ cd /tmp
$ wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2
$ tar jxvf boost_1_80_0.tar.bz2
$ cd boost_1_80_0/
$ ./bootstrap.sh --prefix=/usr/local/
$ sudo ./b2 install -j$(expr $(nproc) + 1)Install LLVM 14. (https://apt.llvm.org/)
Versions other than 13 and 14 may not work.
$ sudo apt install lsb-release software-properties-common gnupg
$ cd /tmp
$ wget https://apt.llvm.org/llvm.sh
$ chmod +x llvm.sh
$ sudo ./llvm.sh 14Clone this repository.
$ git clone https://github.com/yohashinoio/twinkle.git
$ cd twinkleCreate build directory.
$ mkdir build && cd $_Build and install. (If llvm-config command name is llvm-config-14)
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH="llvm-config-14"
$ cmake --build . -j
$ sudo cmake --install .If you want to specify where to install.
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="path/to/install"
$ cmake --build . -j
$ cmake --install .If you want to specify the path to llvm-config.
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_CONFIG_PATH="path/to/llvm-config"
$ cmake --build . -j
$ sudo cmake --install .Passing -DENABLE_TEST=1 to cmake and building will create an executable file for testing.
$ cmake .. -DENABLE_TEST=1
$ cmake --build . -jRun the test with CTest.
$ ctest -VIf you want to compile and link main.twinkle and sub.twinkle.
$ twinkle main.twinkle sub.twinkle
$ ./a.outIf you want to do JIT compilation.
$ twinkle --JIT main.twinkle sub.twinkleSee help for more detailed description.
$ twinkle --help- X3 Documentation: Documentation for Boost.Spirit.X3.
- Using X3 Slides: Slides for Boost.Spirit.X3.
- LLVM Tutorial: Tutorials about using LLVM. Includes a tutorial about making a custom language with LLVM.
- LLVM Reference: 'Doxygen generated documentation' and 'LLVM Language Reference Manual'
- きつねさんでもわかる LLVM: あらゆる可能性を秘めたコンパイラ基盤として注目されている LLVM。本書はコンパイラを実際に作りながら LLVM のフロントエンドからバックエンドまでを幅広く解説した世界初(!?)の LLVM 解説本です。
This project is available under the MIT license.
See LICENSE for the full content of the license.