| .idea | ||
| examples | ||
| compiler.go | ||
| compiler_test.go | ||
| go.mod | ||
| go.sum | ||
| lexer.go | ||
| lexer_test.go | ||
| main.go | ||
| main_test.go | ||
| nodes.go | ||
| parser.go | ||
| parser_test.go | ||
| README.md | ||
| stack.go | ||
| stack_test.go | ||
| values.go | ||
| values_test.go | ||
| vm.go | ||
| vm_test.go | ||
L'anglais
The purpose of this project is to learn how to make a virtual machine for interpreting generated bytecode for improved performance. Hopefully, this will apply to making virtual machines/emulators for real processors
Programming language
The programming language should be compiled, so the performance is not massively impacted.
For example:
- Go
- Rust
- C++ (already used)
- js + bun
- zig
I would like to use a language i know, and preferably strongly typed. Rust has a great compiler with warnings, but at the same time, it would be nice to try out go for once.
Components
The application would need a lexer, to process the grammar into tokens.
Afterwards, the tokens need to be parsed. The type of parser doesn't matter, but it may be nice to try out an LR parser. The parser needs to generate bytecode for the vm.
The vm, as my first, will be stack-based. It should go through the generated bytecode and execute it step by step. There should be support for functions using "jump" instructions.
Grammar
The programming language should have a specified grammar. The grammar will be found as examples in ./examples/.