Started this like a month ago, wanted to understand how compilers actually work under the hood. Picked LLVM because everyone says it's the way to go. Did not expect it to be this painful.
The language is called tTek. The idea is instead of writing event loops you just declare rules β describe when something should happen and it runs:
mem temperature: i32 = 22;
mem ac_on: i32 = 0;
rule too_hot when temperature > 25 && ac_on == 0 {
ac_on = 1;
print("AC on\n");
}
rule shutdown when temperature > 40 {
halt;
}
Spent way too long on the linker throwing undefined reference to WinMain for no obvious reason, object files coming out 0 bytes, segfaults in codegen that had no error message at all. Good times.
Eventually got it working. Compiles to a real native exe through LLVM, no C in between. Functions, if/else, while, sleep, halt β all working.
Repo: https://github.com/RobEst0906/tTek-language
Still a lot missing (timers, preprocessor, proper pointer support) but the core works. Curious what people think of the rule-based approach, and also what I probably did wrong in the compiler lol.
Top comments (0)