I am developing a dynamically typed, object-oriented, garbage-collected programming language written in pure Rust.
Meet Scarlet,
Scarlet is a programming language built in Rust. It compiles source code to Bytecode and executes it on a stack-based virtual machine, with the entire runtime weighing in at just ~500 KB. Scarlet runs natively as a CLI tool and also compiles to WebAssembly for embedded use in browsers and Node.js environments.
✅ Bytecode Compilation: Single-pass Pratt parser that emits bytecode directly, no AST built.
✅ Stack-based VM: Virtual machine with closures, upvalues, and call frames supporting functions as first class data types.
✅ Garbage Collection: Tri-color mark-and-sweep, self-growing Garbage collector.
✅ Object-Oriented: Classes, single inheritance, this, super, and constructors via init.
✅ String Interning: Identical strings share a single allocation for O(1) equality checks.
✅ Bitwise Operators: Full support for &, |, ^, !, <<, >> on integer operands.
✅ Native Functions: Built-in I/O, type introspection, coercion, and timing, platform-gated for WASM.
✅ WebAssembly Target: Compiles to .wasm for web, bundler, and Node.js targets via wasm-pack.
✅ REPL: Interactive session with persistent state across lines.
✅ Debug Mode: Annotated bytecode disassembly for tracing execution.
Scarlet's here on Github: https://lnkd.in/gw2sNCDF
I am building Scarlet as a recreational project, following the clox implementation of the Lox language from the great Crafting Interpreters book by Bob Nystrom.
It was a pain to build the virtual machine, fighting the borrow checker. I wish I could have pivoted to a different language earlier.
I have solved the famous Reverse Nodes in K-Group problem from LeetCode https://lnkd.in/g6ihmfaT in my own programming language - the algorithm is attached below.
I would like to thank Dr. Prasina Sathish m'am, Dinesh D. sir and R. Gowri Thirugnanam ma'am and my class faculty for their encouragement and for fostering a healthy programming culture in our department and college.
Thank you shathika 👍🏻