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
This post is part of the Stack Based Virtual Machines series. After the introduction in the last part, it’s time to start writing some code and dig into stack based virtual machines. We’re going to write a very simple VM in Java (yes, that’s a stack-based virtual machine - our program - running on a stack-based virtual machine - the JVM - that runs on a register-based hardware machine - your CPU.| andreabergia.com
This post is part of the Introduction to parsing series. In the last part we made our parser work with variables. In this part, we’ll take a step back and start setting up the infrastructure for handling function definitions. Immediate evaluation vs AST Our parser is currently working in an “immediate evaluation” mode: as soon as a token is found, it is evaluated. While this has worked well for us so far, it will cause problem when we’ll move towards letting the user define functions:...| andreabergia.com