August 2026 - August 2026

KTNLang

Kompiles To Nothing Lang - My first foray into writing interpreters

JavaKTNLangInterpreters
KTNLang - Cover

About this project

KTNLang is a project built without AI assistance as I learnt to about building interpreters. I followed the book Crafting Interpreters for the concepts.

KTNLang is a dynamically typed language with the following features:

  • Numbers, strings, booleans, and nil
  • Arrays
  • Arithmetic operators
  • Comparison and equality operators
  • Unary operators
  • Comma operator
  • String concatenation
  • Variables and assignment
  • Lexical scoping and variable shadowing
  • Nested blocks
  • if / else
  • Short-circuiting and / or
  • while loops
  • for loops
  • break
  • Functions with parameters
  • Return values
  • Recursion
  • Closures
  • Native functions: clock() and len()
  • _ARCH global variable
  • Array literals
  • Array indexing
  • Array mutation
  • String indexing
  • Array concatenation with +
  • Classes and instances
  • Instance fields
  • Methods
  • Constructors via init
  • this
  • Inheritance
  • Method overriding
  • super
  • Static lexical resolution
  • Semantic error detection
  • Parser and runtime error handling
  • File execution
  • Interactive REPL

Gallery

KTNLang - Image 2
KTNLang - Image 3
KTNLang - Image 4
KTNLang - Image 5
KTNLang - Image 6
KTNLang - Image 7
KTNLang - Image 8
KTNLang - Image 9
KTNLang - Image 10
KTNLang - Image 11
KTNLang - Image 12
KTNLang - Image 13