Hacker News new | ask | show | jobs
by kaba0 1094 days ago
Arguably, I believe a JVM-like stack machine would be an easier endeavor over the proposed one - I feel it is still a bit too close to Brainfuck and doesn’t strike a good balance between ease of implementation vs ease of use as a target architecture.

Even if we take the whole, complete with GC, it is well within the “implementable by a semi-gifted CS student over at most half a year” category.

2 comments

It basically is just the JVM. In terms of longevity, we don't have to limit ourselves to just what one programmer can bang out in half a year from an absolute standing start. We can also include existing code. Existing VMs that work to minimize their footprint and are thus portable to other things relatively easily meet the bill fairly well in the real world, actually.

x86 assembler is likely to be around for a very long time too. It may not be the simplest, but it doesn't have to be, because it's already been implemented several times, in open source.

If I look back at why code doesn't run, by which I mean, real programs that I really wanted to run from the past, this isn't the core problem. I've never failed to run something because the lowest level wasn't working. If nothing else, emulators do a good job of lifting & isolating the underlying hardware and software environment. My problems have been lack of physical hardware, integration with dead OSes (in that dead zone between "the OS is obsolete" and "emulators exist for it now"), changes in input and/or output formats over time (no DOS program from the 20th century knows what to do with a chunk of JSON, no existing program knows what to do with the semi-standardized neural net format from 2052) and the one the article does mention, missing dependencies, even for binaries.

There's a good chance you're right! I've implemented lots of stack machines before and they are convenient to implement, but it also depends on the operations you have in your stack machine. This architecture is capable of representing a stack really easily on the tape using pointers, while also being able to describe any number of memory operations with the same base instructions. I think the equivalent simple-stack-instruction-set might be more limiting in terms of how you're able to use the data on the stack for the same comparable complexity of instructions, compared to an architecture like this where you can move the tape head arbitrarily and interact with the memory in a more free manner while still achieving the same things. I think a stack machine is a subset of this machine.

I found it very simple to implement when I went to port it to the web in Rust and also when I wrote the implementation for the genetic algorithm in Python. You're right that it could be designed for better ease of use, but I was worried most about ease of compilation first and the capacity to express common programming paradigms second. Most of the ease-of-use stuff should be accomplished by the frontend language attached to the architecture.

Thanks for the feedback!!