So You Want to Build a Language VM - Part 13 - Labels
Adds in labels to our VM
Intro
So You Want to Build a Language VM - Interlude 02
Adds in strings to our VM
Hello!
So You Want to Build a Language VM - Part 12 - Strings
Adds in strings to our VM
What are Strings?
This may shock you, but they are a bit more complicated than they might seem. Since a computer cares about bytes, it has no concept of the letter s
, !
or any other letter. These having meaning to us humans. But we want our users to be able to give input and read output without having to do it all in hex. The solution is to use some sort of character encoding. This maps a particular character to a number.
You’ll hear two common encodings mentioned these days: ASCII and UTF. I’m not going to go into an exhaustive history of them; for that, check out this article for ASCII and this article for UTF-8. I will cover enough for us to put in support for strings, though.
So You Want to Build a Language VM - Part 11 - Memory
Adds in heap memory to our VM
Intro
So You Want to Build a Language VM - Part 10 - Assembler 3: Assemble Harder
Teaches our assembler to recognize more instruction forms
Improving the Assembler
Our assembler right now can recognize one opcode, load
. We need to teach it to recognize all the rest. There’s a couple ways we can do that:
We can write a parser for each opcode
We can write a parser that recognizes the letters
a-z
and then check if they are a valid Opcode.
Let’s go with option #2, since it will require much less copy-paste. It also gives us an excuse to implement From<CompleteStr<_>>
for our opcodes!
== The From<&str>
Trait
In instruction.rs
, below the block where we implemented From<u8>
, put this:
So You Want to Build a Language VM - Interlude 01
Goes back and adds docs, tests and other improvements
Fixy fixy
You know how I’ve written several times we’ll come back and fix/change stuff later?
So You Want to Build a Language VM - Part 09 - Assembler 2: Cruise Control
Adds more functionality to our assembler
Megazord…ACTIVATE!!!
So You Want to Build a Language VM - Part 08 - Assembler: The Beginning
Starts on an assembler
Instructions…Assemble!
We could torture ourselves by writing all our programs in hex, and if that’s your thing, this section is technically optional.
So You Want to Build a Language VM - Part 06 - The REPL
Starts building a REPL for the Iridium VM
A REPL
REPL
stands for Read, Evaluate, and Print Loop. It is also referred to as the interactive interpreter for a language.
For example, if you open up Terminal or iTerm, we can look at Python’s REPL:
So You Want to Build a Language VM - Part 07 - REPL and Code Execution
Adds basic hex code evaluation to the REPL