DEV Community

Ankit bishnoi
Ankit bishnoi

Posted on

I wrote a programming language that runs in the browser — introducing Akro

What is Akro?

Akro is a minimal programming language with a browser-based interpreter.

No install needed — you can run Akro code right now at akro-lang.dev/playground.

The name "Akro" starts with "AK" — the initials of the developer @ankitkhileryy.

The name is personal, the language is for everyone.


Why I built it

I wanted a language that combined three things I liked from existing languages:

  • Python — clean, readable syntax
  • Go — fast compilation, simple structure
  • JavaScript — web-native, runs everywhere

None of them alone felt right. So I built Akro.


What it looks like


akro
fn fibonacci(n) {
  if n <= 1 { return n }
  return fibonacci(n - 1) + fibonacci(n - 2)
}

fn main {
  for i in 0..10 {
    say "{i}: {fibonacci(i)}"
  }
}
Output:

0: 0
1: 1
2: 1
3: 2
4: 3
5: 5
6: 8
7: 13
8: 21
9: 34
Key design decisions
:= for variable declaration
name := "Akro"
count := 42
is_fast := true
No var, no let, no const noise. Inspired by Go.

No semicolons, no type annotations required
fn greet(name) {
  return "Hello, {name}!"
}
Types are inferred. You only annotate when you want to.

String interpolation with {expr}
x := 10
say "Double is {x * 2}"   // Double is 20
Supports full expressions, not just variable names.

Pattern matching
score := 87

grade := match score {
  case 90..100 { "A" }
  case 80..89  { "B" }
  case 70..79  { "C" }
  case _       { "F" }
}

say "Grade: {grade}"
Error handling
fn divide(a, b) {
  if b == 0 { throw "Division by zero" }
  return a / b
}

try {
  say divide(10, 2)
  say divide(5, 0)
} catch err {
  say "Error: {err}"
}
First-class functions & closures
nums := [1, 2, 3, 4, 5]
doubled := map(nums, fn(x) { return x * 2 })
say doubled   // [2, 4, 6, 8, 10]
Current status
v0.1.0-beta — The interpreter is written in TypeScript and runs entirely in the browser.

It handles:

Variables, constants, mutation
Functions, closures, recursion
Loops (for, while, loop)
Arrays, maps, structs
Pattern matching
Error handling (try/catch)
String interpolation
Built-ins: map, filter, reduce, sort, len, range, and 40+ more
Native compilation is on the roadmap for v0.3.0.

Roadmap
Version Feature
v0.1.0 ✅  Beta — browser interpreter
v0.2.0  Package manager & modules
v0.3.0  Native binary compilation
v0.4.0  VS Code extension & LSP
v1.0.0  Stable release
Try it
▶️ Playground (no install): akro-lang.dev/playground
📖 Docs: akro-lang.dev/docs/introduction
⭐ GitHub: github.com/ankitkhileryy
Enter fullscreen mode Exit fullscreen mode

Top comments (0)