README.md
September 7, 2024 ยท View on GitHub
A unified language for efficient and expressive code.
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,unitetc.). - 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). unitinstead 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 --versionThis 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.tauand 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 Worldprinted 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.
