We need a machine to run this simulator on. That is we have a memory, and we have a set of registers. We limit the amount of memory, but registers are unlimited.


The memory is treated like any given array. Each slot can contain the max integer-value for the given programming language. In this case we use JavaScript which have a bit of an odd integer convention. In JS integers are treated like floating point values, I think the max value is found here. For now this is not important. We limit the amount of memory. If memory is accessed outside the bound, we throw a segmentation fault.


These are zero initialized, and the amount is unlimited. In this way they are treated much like variables in any given programming language. If we ask for a not yet initialized register, this register is initialized with the value 0 which is returned.