Koder

A modern programming language with Ruby-like syntax

Multi-paradigm, interpreted and compiled. OOP + functional with elegant syntax, pattern matching, metaprogramming, and 5 execution backends.

hello.kd
# Classes with inheritance
class Animal
  def initialize(name, sound)
    @name = name
    @sound = sound
  end

  def speak
    puts "#{@name} says #{@sound}!"
  end
end

class Dog < Animal
  def initialize(name)
    super(name, "Woof")
  end
end

rex = Dog.new("Rex")
rex.speak  # Rex says Woof!

Why Koder?

Designed for developer happiness with powerful capabilities

Multi-Paradigm

OOP with classes, inheritance, mixins, and traits. Functional with lambdas, closures, curry, and pipelines. Use whatever fits best.

Ruby-Like Syntax

Clean, expressive syntax inspired by Ruby. Blocks, string interpolation, ranges, postfix conditionals, and everything you love.

5 Execution Backends

Tree-walking interpreter, bytecode VM, native AOT compiler, JavaScript transpiler, and WebAssembly. Run anywhere.

30+ Stdlib Modules

HTTP server, JSON, TOML, crypto, database, file I/O, networking, async/await, actors, fibers, and much more built-in.

Full Toolchain

REPL, debugger, formatter, linter, LSP server, and package manager. Everything you need for a productive workflow.

Source Converter

Convert existing Ruby, Python, and Crystal code to Koder automatically. Migrate your projects with minimal effort.

VS Code Extension

Syntax highlighting, code completion, diagnostics, formatting, and go-to-definition. First-class editor support.

2800+ Tests

Comprehensive test suite across lexer, parser, interpreter, and stdlib. Rock-solid reliability with continuous testing.

See Koder in Action

Explore the language through real code examples

hello.kd
# Hello World
puts "Hello, Koder!"

# Variables and string interpolation
name = "World"
puts "Hello, #{name}!"

# Classes with attr_accessor
class Person
  attr_accessor :name, :age

  def initialize(name, age)
    @name = name
    @age = age
  end

  def greet
    "Hi, I'm #{@name}, age #{@age}"
  end
end

alice = Person.new("Alice", 30)
puts alice.greet  # Hi, I'm Alice, age 30
functional.kd
# Lambdas
double = -> (x) { x * 2 }
puts double.call(21)  # 42

# Pipeline (method chaining)
result = (1..20).to_a
  .select { |n| n.odd? }
  .map { |n| n ** 2 }
  .reject { |n| n > 100 }
  .reduce(0) { |sum, n| sum + n }

# Curry
add = -> (a, b) { a + b }
add5 = add.curry.call(5)
puts add5.call(3)   # 8
puts add5.call(10)  # 15

# Higher-order functions
def compose(f, g)
  -> (x) { f.call(g.call(x)) }
end

increment = -> (n) { n + 1 }
add1_then_double = compose(double, increment)
puts add1_then_double.call(5)  # 12

# Blocks and yield
def repeat(n)
  i = 0
  while i < n
    yield(i)
    i += 1
  end
end

repeat(3) do |i|
  puts "iteration #{i}"
end
pattern_matching.kd
# Value matching with case/in
status = 200
case status
in 200
  puts "OK"
in 404
  puts "Not Found"
in 500
  puts "Server Error"
end

# Array destructuring
point = [10, 20]
case point
in [x, y]
  puts "x=#{x}, y=#{y}"
end

# Guards
score = 85
case score
in n if n >= 90
  puts "A"
in n if n >= 80
  puts "B"
in n if n >= 70
  puts "C"
else
  puts "F"
end

# Hash patterns
config = {host: "localhost", port: 8080}
case config
in {host: h, port: p}
  puts "#{h}:#{p}"
end

# Type matching
case 42
in Integer
  puts "It's an integer"
in String
  puts "It's a string"
end
metaprogramming.kd
# method_missing — dynamic dispatch
class Ghost
  def method_missing(name, *args)
    "Ghost: #{name} called with #{args}"
  end
end

g = Ghost.new
puts g.hello("world")
# Ghost: hello called with ["world"]

# Dynamic proxy pattern
class LoggingProxy
  def initialize(target)
    @target = target
  end

  def method_missing(name, *args)
    puts "[LOG] Calling #{name}"
    @target.send(name)
  end
end

# send — dynamic method invocation
class Calculator
  def add(a, b) = a + b
  def sub(a, b) = a - b
end

calc = Calculator.new
method = "add"
puts calc.send(method, 10, 5)  # 15

# respond_to? & instance_variables
puts calc.respond_to?("add")  # true
puts calc.respond_to?("fly")  # false
web_server.kd
# HTTP Server with routing
app = HTTP::Server.new

app.get "/" do |req, res|
  res.html "<h1>Welcome to Koder!</h1>"
end

# JSON API endpoint
app.get "/api/hello" do |req, res|
  res.json "{\"message\": \"Hello!\"}"
end

# Dynamic path parameters
app.get "/greet/:name" do |req, res|
  name = req[:params]["name"]
  res.html "<h1>Hello, #{name}!</h1>"
end

# POST with body
app.post "/api/echo" do |req, res|
  res.json req[:body]
end

# Custom status
app.get "/teapot" do |req, res|
  res.status 418
  res.text "I'm a teapot"
end

puts "Listening on http://localhost:8080"
app.listen 8080

Installation

Get Koder up and running in seconds

Build from Source

terminal
# Clone and build
$ git clone https://flow.koder.dev/koder/koder-lang.git
$ cd koder-lang
$ cargo build --release

# Install
$ cp target/release/koder /usr/local/bin/

Quick Start

terminal
# Run a file
$ koder run hello.kd

# Interactive REPL
$ koder repl

# Parse and inspect AST
$ koder parse hello.kd

# Lex and show tokens
$ koder lex hello.kd

Documentation

Everything you need to learn and master Koder