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

I have been working on this project on and off for about 6 months. I would love feedback on the code, design - whatever!


Very concise implementation. I keep thinking there's missing files or at least I'm missing something in my understanding. :)

I wrote a 0-operand VM in C a few years ago that used a lot of the same concepts but considerably more code, like 10x at least. I will learn a lot from this.


Unfortunately, with the ever-increasing processor-memory gap (the growing discrepancy between processor and memory speeds, also called Memory Wall, if I'm not mistaken), 0-operand, or stack VM's are seeing ever-increasing performance penalties.


What kinds of files look missing? I'm curious.

What is a 0 operand VM? I'd love to see it!


Just for anyone looking for more information: http://en.wikipedia.org/wiki/Instruction_set#Number_of_opera...


Awesome!


Using only PUSH and POP I think. i.e a stack machine.

also, OP, your code looks great.


Yeah, a stack machine. https://github.com/dsturnbull/stack_cpu

What I mean by missing files is that it's so clean that at first glance it didn't look like the whole deal :)


Oh well thanks — that's quite a compliment.

This is pretty cool!


Oh interesting. That sounds... complicated.

Thanks! It's my first big C project that isn't hideous :D


Is there a reason for the combination of register-based (logical ops) and stack-based (arithmetic ops) operations?

Otherwise fun project.


Probably just my sloppiness. Things like OR were implemented while looking at other projects like tinyvm, so it's not perfectly consistent.


Nice. Any particular tutorial/article/book you're following?


Perhaps, if you're interested in learning to write well-written C code, you might be interested in the book "C Programming: A Modern Approach"[0] by King. Coding style is an important topic in his book.

[0]: http://www.amazon.com/Programming-Modern-Approach-2nd-Editio...


Thank you, seems very interesting. Usually, I only write pure C code when I really have to. Otherwise, I see no reason why someone should restrict "shimself" from using C++.


Nope :) Lots of small web resources.




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

Search: