Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Funny you mention that - I used that structure in my simple virtual machine (which includes a compiler, a decompiler, support for conditionals, and also an example of embedding):

https://github.com/skx/simple.vm

Rather than having an enum of opcodes I have a array of pointers to functions - one for each opcode I implement. It is a logical/clean way of implementing things, but i think it is not necessarily better.

(In my case I lose due to inline strings, and variable length opcodes which make complications.)



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

Search: