r/Compilers • u/MrCrowley217 • Oct 24 '26
I used AI to create a JS-to-C++ compiler, with no packaged GC or VM.
Repo: https://github.com/alexios-angel/compile-time-browser
This project is AI-generated. Every line of code and every one of its ~6,500 commits was written by AI coding agents, mostly Claude and GPT. I didn't write the code. I just decided what to build, and sometimes directed the agents on how it should work.
I'm posting it here to show how far AI coding has gotten.
What got built
- A browser engine in C++23, from scratch. HTML parser, CSS, layout, a software rasterizer, and its own JavaScript VM. The VM passes 96% of industry-standard JavaScript conformance tests. It opens real pages in a window.
- A compiler that takes plain JavaScript and writes plain C++: structs, classes,
std::vector, RAII, no garbage collector, no VM. When it can't prove something about the code, it refuses with an error instead of guessing. (The C++ it writes is correct but hard to read. It's in SSA form, one variable per intermediate value.)
Hasn't this been done? Turning JavaScript into native code, yes, many times. Almost every attempt either bundles a JS engine with the program or turns every value into a generic "could be anything" type backed by a runtime. All other major implementations package a garbage collector with your compiled code. My compiler does the opposite: it only writes C++ it can type and own, and refuses everything else. It also comes with its own browser engine, so web page code calls straight into it.
It took about 3 months of my time and roughly $40,000 in total, between AI usage and cloud costs/machines.
Where it is now
It's an alpha, and as of this week, current AIs are not good enough to continue progress on the goal of compiling real-world programs. The browser works on a lot of pages. The compiler handles small programs completely, but big real-world scripts are still mostly refused. I've shut down the cloud services I was using and AI API's until the AI does get good enough to continue writing code for the project.
Maybe if I get enough extra cash flow, I will continue the project in the immediate future.
AMA about the workflow, the costs, or what the AI wrote (I barely understand most of the code myself).
