This post is part of the Stack Based Virtual Machines series. In the previous part we have implemented an “if” and a “while” statement. In this part, we’ll extend our virtual machine and add support for function calls! The status of the code at the time of this article can be seen on GitHub. Calling a function A function is generally nothing more than a particular address that the code jumps to.| andreabergia.com
This post is part of the Stack Based Virtual Machines series. In the previous part we have implemented quite a few instructions for our virtual machine. In this part, we’ll further extend its capabilities by adding some comparison instructions, the ability to do jumps and local variables. The relevant code for this part can be seen on github. Comparison instructions Let’s add a few simple instructions to our repertoire: we’re going to add some instructions to compare two numbers.| andreabergia.com