honziitko/good-luck-compiler
When the compiler doesn't have enough work
A library that generates and runs a random Turing machine — at compile time.
Because why wait for runtime when you can confuse yourself earlier? :sweat_smile:
Good luck, compiler! is an experimental library that explores the limits of compile-time computation. On every build, it generates a fully random Turing machine and executes it as part of the compilation process. :hammer_and_wrench:
The result? A program whose behavior isn't known until it's compiled — and maybe not even then. :man_shrugging:
:test_tube: Test the boundaries of what your compiler can handle.
:bulb: Demonstrate the halting problem in a real-world, build-time context.
:slot_machine: Introduce non-determinism into your build process (for science!).
:books: Explore computability theory in a tangible, hands-on way.
:thread: Break CI pipelines
:game_die: Random Turing machine generation at compile time — new machine every build!
:stop_sign: May halt... or not — compile-time simulation of undecidable computation.
:gear: Fully configurable: number of states, tape symbols, transitions.
(Editorial note: Why the fuck did it switch to colons?)
(Editorial note: Huh?)
const std = @import("std");
const glc = @import("glcompiler");
pub fn main() !void {
@setEvalBranchQuota(6767); // Set to BB for correctness
std.debug.print("TM halts: {}\n", .{glc.haveFun()});
}
First and foremost, run the build system.
(Note that this requires an ANSI C compiler.)
$ cc -o build build.c
$ ./build
#include <string>
#include <iostream>
#include <boost/core/demangle.hpp>
#include <glc.h>
#include <randable.h>
using MachineN = glc::have_fun<glc::randable>;
template <class T>
std::string type_name() {
return boost::core::demangle(typeid(T).name());
}
int main() {
std::cout << type_name<MachineN>() << "\n";
}
(Compile with c++ -Iinclude)
I sincerely apologize for using AI, but, I am not an expert in emojis nor marketing. I thought it was funny. In a serious project, I'de write the README myself.