Inspiration

Compilers can be inefficient. Sometimes they have very high optimization levels and make really optimized code, but do mathematical operations that assumes floating point arithmetic is equivalent to exact arithmetic. Other times, they reuse registers and swap too many things to the stack. The goal of this project is to create a middle ground, a language that does not do excessive register swapping, while doing algorithms the way the programmer told them to do. And of course, we exist in the age of AI so why would a language made in 2025 not natively support Gemini.

What it does

TG-lang is a fully functional compiler that creates binary files with arithmetic, boolean logic, nested loops, printing, if statements and logical branching BUT with a twist. We allow for native calls to Gemini in the language with the basic imbedded function Gemini().

How we built it

We made a large file, build.py, which parses individual lines into Abstract Symbol Trees and then turns the Abstract Symbol Tree into a series of assembly instructions. These assembly functions are then turned into a binary using a call to clang, giving us an executable.

Challenges we ran into

We ran into many errors trying to get the puts syscall to work for printing.

Accomplishments that we're proud of

We can now say we've made a compiler and language.

What we learned

We learned about branching at an assembly level.

What's next for TG-Lang

Remaking the entire thing in C, updating syntax and forcing heavy optimizations. Perhaps also adding OpenAI, Claude, Grok and DeepSeek calls directly into the language to support a wider variety of the future.

Built With

  • assembler
  • keystone-engine
  • nasm
  • python
  • regex
Share this project:

Updates