programming language with a stack-based bytecode vm implemented in golang
Find a file
2024-10-09 14:20:55 +02:00
.idea Initial commit 2024-10-08 15:08:56 +02:00
examples Initial commit 2024-10-08 15:08:56 +02:00
compiler.go add nil check in CompareValues and log before comparing value on stack 2024-10-09 14:20:55 +02:00
compiler_test.go Initial commit 2024-10-08 15:08:56 +02:00
go.mod Initial commit 2024-10-08 15:08:56 +02:00
go.sum Initial commit 2024-10-08 15:08:56 +02:00
lexer.go let numbers be written with decimals 2024-10-09 09:36:24 +02:00
lexer_test.go Initial commit 2024-10-08 15:08:56 +02:00
main.go update main file parsing error handling 2024-10-09 09:15:43 +02:00
main_test.go Initial commit 2024-10-08 15:08:56 +02:00
nodes.go Initial commit 2024-10-08 15:08:56 +02:00
parser.go add parsing for while loops 2024-10-09 09:15:25 +02:00
parser_test.go Initial commit 2024-10-08 15:08:56 +02:00
README.md Initial commit 2024-10-08 15:08:56 +02:00
stack.go Initial commit 2024-10-08 15:08:56 +02:00
stack_test.go add nil check in CompareValues and log before comparing value on stack 2024-10-09 14:20:55 +02:00
values.go add nil check in CompareValues and log before comparing value on stack 2024-10-09 14:20:55 +02:00
values_test.go add nil check in CompareValues and log before comparing value on stack 2024-10-09 14:20:55 +02:00
vm.go Initial commit 2024-10-08 15:08:56 +02:00
vm_test.go add a vm_test of a function calling a function 2024-10-09 09:15:07 +02:00

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/.