| ▲ | gobdovan 5 hours ago | |
I had a similar surprise about how approachable PL is, but from going from 'the bottom up' instead from a normal language. I wrote a compiler toolchain and debugger that takes a Turing machine description plus input string and emits an encoded tape runnable by a Universal Turing Machine [0]. I had some prior PL experience, but never did an end-to-end compiler pipeline, at least not this low level. It started as a joke/experiment, but I couldn't believe how fast it pulled me into designing: - a small low-level ASM for building the UTM - an ABI for symbol widths and encoding grammar - an interpreter used as the behavioral oracle - raw TM transitions for each ASM instruction, generated by having an LLM iterate on candidate emissions and checked against the interpreter oracle - a CFG-style IR to fix the LLM mess once direct ASM -> TM emission became too hard to keep sane (LLM did a decent job actually, I don't think I would have done a much better job without the IR either) - a gdb-style debugger for raw transitions, ASM routines, and blocks - a trace visualizer - a bootstrapping experiment where an L1 UTM/input pair was itself run through an L2 UTM - optimisation experiments And every step came quite naturally and was easy to tie in with everything else. Each one was just the next local repair needed to make the previous layer tractable. [0] Repo: https://github.com/ouatu-ro/mtm | ||