Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: A virtual machine in the Rust type system (github.com/aurel300)
2 points by Aurel300 4 days ago | hide | past | favorite | discuss
As a follow-up to a CTF challenge I wrote, I created a small proof-of-concept virtual machine embedded in the Rust type system. Trait resolution and in particular associated types are used to "execute" a program, represented as a type, to its final state. (The "execution" happens during Rust compilation.)

The VM architecture is simple: two 8-bit registers, a stack, a small number of instructions, including conditional control flow. However, other than patience and hitting the recursion limits, more useful/realistic architectures could be embedded as well.

I wrote a blog post that goes into more depth about how this was developed and how it all works: https://www.thenet.sk/blog0011

 help



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: