Bytecode, Compilers and Interpreters

Recently I have been looking at languages and compilation: VMs, parse trees, lexers, and interpreters. Nand to tetris is a pretty awesome guide to how the CPU executes programs - from logic gates to high level languages.

Assembler and Bytecode VM

I created an assembler and Virtual Machine to run assembly style instructions. I haven’t released it as it isn’t as complete as I want it yet.

Parse Trees and Reverse Polish Notation (RPN)

Turns a string such as “( 0 - (6) + ( 6 ^ 2 - 4 * 1 * 5 ) ^ (1 / 2) ) / ( 2 * 1)” into a binary syntax tree, and then into Reverse Polish Notation, and then executes it.

Lexical Analyser

I have also experimented with a simple Lexical Analysisor, however it’s not at a state that I’d like to release.

Rufunge

Befunge is an esoteric programming language - a language which isn’t meant for pratical use, but rather to test programming use. The language consists of a two dimensional grid of characters. Each character is an individual instruction. I was disappointed that the authors didn’t take it seriously enough, and didn’t add input and output to it. So, I created my own! I called it ‘Rufunge’. It’s not finished yet, but can currently run most Befunge programs.

Mesecode

Mesecode is a language which compiles to Lua. It’s purpose it to make definitions in Minetest easier to read.

Instead of:

minetest.register_node("default:stone", {
    description = "Stone",
    tiles = {"default_stone.png"},
    is_ground_content = true,
    groups = {cracky=3, stone=1},
    drop = 'default:cobble'
})

You can write:

mod default

node Stone
    is ground, cracky=3, stone
    drops Cobble
Comments

Comments are currently disabled whilst we remove the dependency on a third party service which was taken offline. In the meantime, feel free to send a message to me on Twitter.

  • Jeija

    Nice, work Ruben!