Skip to content

Latest commit

 

History

2,506 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Ballerina Nutcracker

A native interpreter for the Ballerina programming language.

Release Native CI codecov License Discord

Website  ·  Playground  ·  Language spec  ·  Developing  ·  Architecture  ·  Roadmap


Ballerina is an open-source, cloud-native programming language optimized for integration, with built-in support for JSON and XML, first-class constructs for services and concurrency, and structural typing. It is developed and supported by WSO2 and the wider Ballerina community. Try the language in your browser on the Ballerina Playground.

Ballerina Nutcracker compiles Ballerina source to Ballerina Intermediate Representation (BIR) and interprets the BIR directly. Written in Go, it ships as one bal binary — no separate runtime, nothing to warm up — which keeps startup fast and the footprint small for short-lived cloud-native workloads such as CLIs, functions, and sidecars.

Important

Nutcracker is under active development and does not yet support the whole language. For production use today, reach for Ballerina Swan Lake — the official distribution, which supports the full language.

Architecture

Ballerina Nutcracker architecture: the bal CLI (new, run, pack, build, push, version) is the entry point. parser/ produces st/; nodebuilder/ produces ast/. semantics/ resolves types; desugar/ and birgen/ lower to BIR. The runtime interprets BIR. Native stdlib uses extern calls; pure-Ballerina modules run as BIR. PAL is platform/pal; palnative is on the host OS and pal_wasm.go on the browser. The central cache is the on-disk default for dependency resolution; bal push writes the local repository.

Almost everything that ships in the bal binary is a Go package. The central cache, the local repository, the host OS, and the browser sit outside it. See ARCHITECTURE.md for how the diagram maps onto source directories.

Getting started

Download a binary from the latest release, or build from source with Go 1.27 or later:

git clone https://github.com/ballerina-nutcracker/ballerina.git
cd ballerina
go build -o bal ./cli/cmd

Create and run your first program:

./bal new hello
./bal run hello
import ballerina/io;

public function main() {
    io:println("Hello, World!");
}
Command Description
bal new <path> Create a new package (-t <template>, --workspace)
bal run <file.bal> | <package-dir> | . Compile and execute a source file or package
bal pack [<package-dir>] Build the .bala distribution archive of a package
bal build [<package-dir>] Build a standalone executable that bundles the Ballerina runtime
bal push [<bala-path>] --repository=local Push a .bala of the current package (or a given archive) to the local repository
bal version Print the version

bal build needs a balrt stripped-down runtime alongside bal (go build -o balrt ./cli/internal/balrt), or pointed at via the main.RuntimeStubPath link-time override.

For debugging flags, profiling, testing, and linting, see DEVELOPING.md.

Scope & roadmap

Development is organized by subsets of the Ballerina language; each milestone adds support for a defined subset.

Contributing

Contributions are welcome — read the contribution guidelines to get started, and the code of conduct before you take part.

Community

Questions and ideas belong in GitHub Discussions or on Discord — Discord is where the team is most active. See ballerina.io/community for everything else.

License

Distributed under the Apache License 2.0.

About

Native Ballerina Interpreter

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

107 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages