Awesome
<p align="center"> <img src="img/logo.svg" alt="Tau Logo" width="80%"> </p> <h1 align="center">A unified language for efficient and expressive code.</h1>Welcome to Tau, a programming language designed to be simple yet powerful. This repository contains the compiler for Tau, written in C and utilizing LLVM for backend processing.
[!IMPORTANT] The project is in its early stages, and the language is still evolving.
🚀 Features
Syntax
- Clean, concise, consistent.
- Keywords are short and recognizable (
fun
,pub
,unit
etc.). - Similar to other popular languages like C/C++ and Rust.
Types
- Strong and strict type system.
- Bounds checked arrays.
- No null pointers, explicit optionals (
?i32
). - References (
&i32
). unit
instead ofvoid
.- Structs, unions, enums.
Control Flow
- Conditional branches (
if-then
,else
). - Loops (
while-do
,do-while
). - Deferred statements (
defer
).
Functions
- Simple function definitions (
fun factorial(x: i32): i32
). - External function declarations (
extern "C" fun sqrtf(x: f32): f32
).
Expressions
- Arithmetic, logical, bitwise and comparison operators.
- Safe and unsafe optional operators (
x?
,x!
). - Memory related operators (
*x
,&x
). - Special operators (
sizeof
,alignof
).
⚙️ Installation
Prerequisites
- CMake: Build tool to configure and manage the build process.
- LLVM: Used as the backend for code generation and optimization.
Building the Compiler
-
Clone the Repository:
git clone https://github.com/Baleg00/tau-lang.git cd tau-lang
-
Create a Build Directory:
mkdir build cd build
-
Configure the Project:
cmake ..
-
Build the Project:
cmake --build .
-
Install:
cmake --install .
After installation add the folder (where Tau was installed to) to your environment variables.
-
Verify Installation:
Verify that Tau was installed correctly by running the following command:
tauc --version
This should display the installed Tau version.
👏 That's it! You're now ready to start using Tau for your programming projects. If you encounter any problems during installation or have questions, feel free to open an issue.
❤️ Happy coding with Tau!
📦 Usage
Here's how you can create and compile your first Tau program.
-
Create Source File:
Create a file called
hello.tau
and add the following code:extern "C" fun printf(fmt: *u8, ...): i32 fun main(): i32 { printf("Hello World!") return 0 }
-
Compile:
Compile the Tau source code into an object file.
tauc --emit-obj hello.tau
-
Link:
Use a linker to compile the generated object file into an executable.
gcc -o hello.exe ./hello.tau.obj
-
Run:
Run the executable! If everything went according to plan, you should see
Hello World
printed to your screen../hello.exe
🤝 Contributing
If you'd like to contribute to the Tau project, please check out the Contribution Guidelines.
📄 License
This project is licensed under the Apache 2.0 License.