Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Techlang 🔧

Release License: MIT Made with C++

A compiled, statically-typed programming language with an LLVM backend, and VecTec, a companion language for writing GPU compute code. Built from scratch in C++.

Techlang has familiar C-like syntax, compiles straight to native binaries through LLVM, and comes with a standard library, editor plugins, and a full examples suite. Its companion language, VecTec, lets you write parallel GPU workloads that run on CUDA.

🌐 Website · 📖 Language Reference · 🧩 Examples


About this project

I built Techlang to understand how a real language works from top to bottom: lexing, parsing, type checking, and generating native code through LLVM, rather than reading about it. Then I took it further than I'd planned and added VecTec, a small companion language for GPU compute, so I could learn how parallel code gets compiled and dispatched to a GPU too.

The core language is complete and stable: everything documented here works, and it compiles real programs to native binaries today. It's a personal project rather than a production toolchain, I'm not expecting anyone to ship software in it, but it's a fully working compiler, and I'm proud of how far it got. Feedback and contributions are genuinely welcome if you find it interesting.

Features

  • Familiar syntax — if you know C, C++, or Java, you'll feel right at home
  • Statically typed — catch errors at compile time, not at runtime
  • Native & fast — compiles to native binaries via LLVM with full optimization support
  • Modern essentials — structs, enums, pointers, arrays, and a clean module system with !import
  • GPU compute — write parallel workloads in VecTec, Techlang's CUDA-backed companion language
  • Batteries included — a standard library plus editor plugins for VS Code and Neovim

Quick Example

!import(std.tec) as std;

struct person = {
    int age;
    string name;
}

function greet(person p) returns none {
    std.print("Hello, ");
    std.print(p.name);
}

function main() returns none {
    person p;
    p.age = 25;
    p.name = "Alice";
    greet(p);
}
$ ./hello
Hello, Alice

GPU examples using VecTec live in examples/gpu/.

Installation

Quick install (Linux x64):

wget https://github.com/gummyniki/techlang/releases/download/v0.1.0-alpha/techlang-linux-x64.tar.gz
tar -xzf techlang-linux-x64.tar.gz
cd techlang-linux-x64 && ./install.sh

Requirements

  • LLVM 17+
  • GCC
  • CMake 3.20+
  • Linux or macOS
  • CUDA toolkit — only if you're using VecTec

Build from source

git clone https://github.com/gummyniki/techlang
cd techlang
mkdir build && cd build
cmake ..
make

The compiler binary will be at build/techlang. Optionally add it to your PATH:

export PATH=$PATH:/path/to/techlang/build

Compile and run a Techlang file

./build/techlang hello.tec
./hello

Examples

The examples/ directory contains programs demonstrating each of Techlang's features:

Example Description
hello.tec Hello World
fibonacci.tec Recursive Fibonacci sequence
structs.tec Structs and methods
enums.tec Enums and control flow
pointers.tec Pointer usage and pass-by-reference
arrays.tec Arrays and iteration
imports/ Multi-file programs with imports
casting.tec Casting a variable's type to another
file_editing/ File I/O
gpu/ GPU computing with VecTec

Run the whole suite:

chmod +x run_tests.sh
./run_tests.sh

Standard Library

Import the standard library with:

!import(std.tec) as std; // std.tec must exist in your working directory — copy it from examples/
Function Description
std.print() Print to standard output
std.print_newline() Print a newline
std.read_int() Read an integer from stdin
std.read_float() Read a float from stdin
std.sqrt(float x) Square root
std.exit(int code) Exit the program
std.concat(string a, string b) Concatenate two strings
std.string_length(string s) Get string length
std.string_equals(string a, string b) Compare strings (returns 1 if equal)
std.string_substring(string s, int start, int end) Extract a substring

Editor Support

Editor Plugin Status
VS Code techlang-vscode ✅ Available
Neovim techlang-nvim ✅ Available

Language Reference

The full syntax reference lives in docs/LANGUAGE.md.

Status

Techlang's core is feature-complete. Here's where things stand:

Done

  • Basic types (int, float, double, char, string, bool)
  • Arrays, pointers, structs, and enums
  • Functions and full control flow (if/else, while, for)
  • File imports and a simple module system
  • Standard library
  • Compiles to native binaries via LLVM
  • Helpful compile-time error messages
  • VS Code + Neovim editor support
  • VecTec — GPU compute companion language
  • Language Server Protocol (LSP)

Not implemented (possible future directions)

  • Package manager

Contributing

Contributions are welcome. If you find a bug or want to add a feature:

  1. Fork the repository
  2. Create a branch: git checkout -b my-feature
  3. Make your changes
  4. Run the test suite: ./run_tests.sh
  5. Open a pull request

For larger changes, please open an issue first so we can talk through the approach.

License

MIT — see LICENSE for details.

About

Compiled programming language targeting LLVM with a secondary language ran on the GPU

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages