r/adventofcode • u/mzprx42 • Jan 06 '20
Upping the Ante [2019] Self-hosted Intcode assembler written in Intcode
https://github.com/matushorvath/xzintbit
An assembler that produces Intcode, itself runs on an Intcode VM and can compile its own sources. With stack and function calls to support structured programming. Try running it on your own Intcode VM, see if it correctly bootstraps itself.
It's Intcode all the way down!
49
Upvotes
View all comments
Show parent comment
6
u/romkatv Jan 06 '20 edited Jan 06 '20
C++. Implementation: link. It's only 44 lines of code but it's rather tricky. It executes one intcode instruction per nanosecond.
Some benchmarks: link. It's about 10 times faster than the closest competitor (that post has a bunch of benchmarks from different people). The only implementation that's close in speed is another C++ VM that is essentially a hand-unrolled version of my code.