2025
JavaANTLRCompilerVirtual Machine

Klyvos

A programming language built in Java with a custom compiler, bytecode format, and stack-based virtual machine.

Klyvos is a programming language project I built as a challenge to myself when I was 17. The goal was to understand how programming languages actually work internally instead of treating compilers and runtimes like black boxes.

The project includes:

  • a lexer and parser using ANTLR
  • an AST-based compilation pipeline
  • a custom bytecode format (.klvb)
  • a stack-based virtual machine written in Java

Compilation Flow

source (.klvs)

ANTLR parser

AST generation

bytecode compiler

.klvb bytecode

Klyvos VM

Example Syntax

const a = 10
const b = 5

println(a + b)

Notes

I built most parts from scratch, including the instruction system and execution model. The project was mainly an experiment in language design, parsing, and runtime execution.

It gave me a much better understanding of how interpreters, compilers, and virtual machines work under the hood.