Coluber: A Compiled Language Designed for Clarity and Simplicity
Over the years, I have grown increasingly fond of the idea that code should read like prose: clear, intentional, and free from unnecessary noise. This curiosity led me to build Coluber, a compiled, statically-typed programming language designed around three core values: Fun, Simple, and Fast.
What is Coluber?
Coluber is a personal hobby project and an open-source language written in Nim. It works by transpiling .clbr source files into Nim (or optionally Vlang), which are then compiled by their respective toolchains into native binaries. The language takes inspiration from Python's indentation-based readability while targeting the performance characteristics of compiled languages. Think of it as a thin, clean layer above a highly optimized native compiler.
The name comes from Coluber, a genus of non-venomous snakes, known for being fast, agile, and adaptable.
Syntax Overview
Coluber deliberately avoids symbols that tend to add visual clutter. No semicolons, no curly braces, and no cryptic logical operators. Here is what a typical Coluber function looks like:
public task calculate_score(points: int, bonus: int) -> int:
serve total = points + bonus
cond first (total > 100):
say("Excellent score.")
cond other (total >= 50):
say("Good result.")
cond nothing:
say("Keep going.")
serve total
A few things worth noting:
serveis used to declare variables. The type is inferred automatically, though explicit annotations are supported.cond first/cond other/cond nothingreplace theif/elif/elsestructure.loopandcrawlreplacewhileandforrespectively.taskdefines functions.
The syntax is intentionally orthogonal - there is one clear way to do each thing, which keeps code consistent and easy to follow.
The FFI Bridge
One of the more interesting aspects of Coluber is its unified Foreign Function Interface. Rather than building a standard library from scratch, Coluber allows developers to call into existing code written in C, Nim, Python, or JavaScript using a single keyword: introduce.
introduce python/mathpy task compute_square(x: int) -> int alias square
public task main():
serve result = square(9)
say("Result: {result}")
When compiling a project with FFI dependencies, Coluber automatically bundles the relevant .py or .js files relative to the output binary. This makes the compiled program fully portable - the dependencies travel with the executable, regardless of where it is moved.
String Features
Coluber supports standard string interpolation using {expression} syntax, as well as the full set of escape characters you would expect from a C-family language:
serve name = "World"
say("Hello, {name}!\nThis is a new line.\tAnd this is a tab.")
Supported escape sequences include: \n, \t, \r, \a, \b, \f, \v, \0, \', \", and \\.
Project Status
Coluber is, frankly, a work in progress - and that is part of what makes it interesting to work on.
Repository:
Comments
No comments yet. Start the discussion.