This course should help lost souls programmers to construct virtual
machines and understand many of the issues that go with designing one. The
main goal is to dismistify how VMs and interpreters work while also showing
the power of being able to create them.
The target audience for this material are the curious programmers who wonder about what lies beneath the hood of the interpreters they use everyday. Moreover, among these there might be a hacker who plans to actually build his own language and system one day.
The themes explored here are those of [single] stack based virtual machines. There won't be journeys to multi-stack machines nor register based ones. However, expect old and modern techniques to make appearences.
-
This is a very terse course entirely based on exercises.
-
Each exercise was designed to be an increment over the predecessor and they should be completed in
< 1 hour
. -
The exercises in itallics require more effort, so may take a little longer.
-
Your medium must be a system programming language like C or anything that manipulates raw memory with pointers. There's no point in trying to learn how things work under the hood if one is always over the hood; the exception is the warm up exercise #1 where a highlevel language is permitted to be used.
-
Compiler writing skills might come in handy, but for most part, only basic understanding of text manipulation is necessary.
If you want to present your solutions and/or discuss them, do the following:
- Fork this repository
- Create a branch following the pattern chX/YY (e.g., ch1/01, ch1/02)
- Push to that branch
- Create a pull request to my repository with the title "chX/YY by [username]" (e.g., ch1/01 by hltbra)
- Wait for comments.
If you are suggestion a solution, feel free to leave the pull request opened so other people can learn too.
Level: , Time: 🕕
- Exercise #1: Basic stack machine in python
- Exercise #2: Basic stack machine in C
- Exercise #3: VM with primitive routines
- Exercise #4: VM with user-defined routines
- Exercise #5: VM with parameterized user-defined routines
- Exercise #6: VM with routines and local variables
Level: , Time: 🕐
WIP
Level: , Time: 🕐
WIP
Level: , Time: 🕐
WIP
Level: , Time: 🕐
WIP