TeaLang is a compiler for Tea, a C-like language with cpp2 syntax. You can write programs in it, compile and run them! TeaLang is currently implemented as a frontend for LLVM. It has its own tokenizer, parser, AST, semantic analysis and LLVM IR generator. Then LLVM does its magic to produce an executable from LLVM IR.
Note: the project assumes that LLVM 22 or 23 is installed in your system. clang++ must be in your PATH. You can use
docker image described in
Dockerfile to quickly set up all required dependencies. Testing additionally requires the following LLVM tools: lit,
FileCheck, and llc. You can disable testing targets
by passing -DTLANG_TEST=OFF.
git clone --recursive https://github.com/MishkaSimakov/RecursiveFunctions
cd RecursiveFunctions# macOS/Homebrew:
export LLVM_DIR="$(brew --prefix llvm)/lib/cmake/llvm"
cmake -S . -B build
cmake --build build -t tlangCreate main.tea file:
import "io"
main: () -> i64 = {
println("hello world!");
return 0;
}Then compile and run it.
build/bin/tlang main.tea
./outThere are two types of tests: lit and unit. You can run both of them:
cmake --build build -t tests.unit
./build/bin/tests.unit
cmake --build build -t tests.litcmake --build build -t tlang
sudo cmake --install build
tlang --versionThere are a few examples in examples directory. You can build and run them using Make. For example to play a game
implemented completely in tea language run:
cd examples/game
make run TLANG=../../build/bin/tlangYou can find more information in documentation (ru).
