Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BeeLang logo

BeeLang

Build Everything Easily — a small, friendly scripting language with a built-in native (LLVM) JIT.

License: MIT Language: C++17 Platforms Version

Install · Quick start · Language tour · Packages · Bindings · Docs · Examples

fn greet(name) {
    return "Hello, " + name + "!"
}

print(greet("world"))     # Hello, world!

BeeLang is a dynamically-typed language designed to be easy to read and quick to pick up — familiar C-style syntax, first-class functions and closures, classes, a real module system, threads, and a batteries-included standard library. BeeLang runs on a compact C++17 runtime that transparently compiles hot numeric functions to native code with a built-in LLVM JIT, so tight loops run at near-native speed.


✨ Features

  • Clean, familiar syntaxlet, fn, if/while/for, class, and both # and // comments.
  • String interpolation & slicingf"{name} has {n}", xs[1:3], s[-5:].
  • An interactive REPL — run bee with no arguments, or bee -e '<code>' for a one-liner.
  • First-class functions & closures — pass functions around, capture state, build counters and callbacks.
  • Classes & single inheritance — constructors, methods, this, super, and custom str() for printing.
  • Module systemimport, from … import, aliases, and a sibling lib/ search path.
  • A package managerhive install <package> fetches a package into hive_modules/, where import finds it. See the Hive guide.
  • Native modules & automatic bindings — call C/C++ from BeeLang, and generate the glue from a header with beegen. See the bindings guide.
  • Error handlingtry / catch / finally with throw of any value.
  • Real stack traces — every error names the file, line and function it came from, all the way back to <main>.
  • Threads with a GIL — safe shared state and real overlap for I/O-bound work.
  • Rich standard library — strings, lists, dicts, math, files, time, random, env, and process execution — no imports needed.
  • Native LLVM JIT — numeric-heavy functions are compiled to native code and run at near-native speed, transparently.
  • First-class editor support — a VS Code extension with highlighting, completions, hovers, and snippets.

📦 Installation

Download & run — no compiler needed

Platform Package How
Windows bee-0.3.1-amd64.exe Run the installer. It adds bee and hive to your PATH and gives .be / .bee files a bee icon so you can double-click to run them.
Debian / Ubuntu bee-0.3.1-amd64.deb Double-click (opens your software centre) or sudo apt install ./bee-0.3.1-amd64.deb. Installs bee and hive.

Grab the latest packages from the Releases page.

Build from source

Requires a C++17 compiler, make, and LLVM (17/18) for the JIT:

sudo apt install llvm-18-dev   # the JIT dependency (Debian/Ubuntu)
make                           # builds ./bee (with the native JIT), ./hive and ./beegen
make test                      # end-to-end tests for hive and module resolution
sudo cp bee hive beegen /usr/local/bin  # (optional) put them on your PATH

The packaging scripts in packaging/ reproduce the release artifacts: packaging/build-deb.sh builds the .deb, and packaging/windows/ holds the Inno Setup script and a guide for building the Windows installer.

🚀 Quick start

Save this as hello.bee:

let names = ["Ada", "Alan", "Grace"]

for name in names {
    print("Hello, " + name + "!")
}

Run it:

bee hello.bee
Hello, Ada!
Hello, Alan!
Hello, Grace!

A source file uses the .be or .bee extension. Statements may end with an optional semicolon; newlines are not significant.

bee --version              # bee 0.3.1
bee --help                 # usage and options
bee                        # an interactive REPL
bee -e 'print(1 + 1)'      # run one line

📚 Packages

hive, BeeLang's package manager, ships with bee:

hive init                     # start a project (writes hive.json)
hive install greet            # fetch a package into ./hive_modules
hive install greet@^1.2.0     # ... a particular version
hive install ./greet-1.2.0.pkg    # ... or a local .pkg package
hive list                     # what's installed

Then import it by name:

import greet

print(greet.hello("BeeLang"))

Dependencies resolve transitively, every download is checked against its SHA-256, and hive.lock pins exact versions so a repeat install — or an --offline one — gets the same bytes. Publishing is hive pack plus a static file on any web server.

Full guide → docs/HIVE.md

🔗 C++ bindings

beegen reads a C++ header and writes the bindings for you — a native module plus a BeeLang wrapper:

beegen shapes.hpp --module shapes   # parses the header with libclang
./build.sh                          # compiles shapes_native.so
import shapes
from shapes import Rect

print(shapes.greet("BeeLang"))
let r = new Rect(3, 4)
print(r.area())                     # calls the real C++
r.free()

C++ classes become BeeLang classes, enums become dicts, and anything that can't be mapped is reported rather than silently dropped. Native modules load with import, so binding a library never means rebuilding the interpreter.

Full guide → docs/BINDINGS.md

🐝 Language tour

Closures

fn counter() {
    let n = 0
    fn tick() { n += 1; return n }
    return tick
}
let c = counter()
print(c(), c(), c())   # 1 2 3

Classes & inheritance

class Animal {
    init(name) { this.name = name }
    speak() { return this.name + " makes a sound" }
}
class Dog extends Animal {
    speak() { return super.speak() + ": woof!" }
}
print(Dog("Rex").speak())

Modules

from mathutil import square, PI
print(square(5))   # 25
print(PI)

Error handling

try {
    throw {"kind": "range", "msg": "too big"}
} catch (e) {
    print(e.kind, "-", e.msg)
}

Threads — overlap blocking work; the GIL keeps shared state safe:

fn download(url) { return exec("curl -s " + url).output }

let a = spawn(download, "http://example.com/a")
let b = spawn(download, "http://example.com/b")
print(join(a), join(b))   # both downloads ran concurrently

See the full Language Reference for everything: values, operators, control flow, the standard library, type methods, and more.

⚡ Performance

BeeLang ships with a built-in LLVM ORCv2 JIT. Functions that stay within a numeric subset are compiled to native code operating on unboxed doubles; the rest of your program runs on the runtime, with identical results. The JIT is enabled by default — just make sure LLVM (17/18) is installed before you build:

sudo apt install llvm-18-dev   # Debian/Ubuntu — the JIT dependency
make                           # "Building with LLVM JIT via ..."
bee examples/13_benchmark.bee
Benchmark Without JIT With JIT
fib(32) ~11 s ~0.014 s

If LLVM isn't found at build time, make falls back to a JIT-less binary that behaves identically, just slower — handy for minimal environments.

🧩 Editor support

A VS Code extension provides syntax highlighting, completions (keywords, built-ins, .-methods, and file symbols), hovers, and snippets — plus a bee icon for .be / .bee files. It lives in its own repository and is versioned independently; see its README to install.

🗂️ Project layout

BeeLang/
├── src/               # the C++17 interpreter (lexer, parser, resolver, VM, JIT)
├── examples/          # sample .bee programs
├── lib/               # standard-library modules search path
├── packaging/         # .deb builder + Windows (Inno Setup) installer
└── docs/LANGUAGE.md   # full language reference

🤝 Contributing

Issues and pull requests are welcome. To hack on the interpreter:

make            # build
make run FILE=examples/01_hello.bee
make clean

BeeLang is plain C++17. The built-in native JIT uses LLVM (17/18) — install it to build the default JIT-enabled bee; without it the build still works, just without native compilation. Sources live in src/.

📄 License

Released under the MIT License. © 2026 Atanu Debnath.

About

The Bee Programming Language

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages