flarisvm hello.fls
Fast, embeddable, and concurrent by design. Flaris combines fiber-based async/await with a compact bytecode VM written in C - familiar syntax, deterministic execution, and a 35-module standard library.
// A quick taste of Flaris fn async fetchData(url:string):object { var resp = await Http.Get(url); return Json.Parse(resp.body); } fn async Main() { let data = await fetchData("https://api.example.com/data"); Console.WriteLine("Received: " + data.toString()); // Fibers run concurrently on the cooperative scheduler let jobs = [ fetchData("https://api.example.com/a"), fetchData("https://api.example.com/b"), ]; foreach (let j in jobs) await j; return 0; }
Why Flaris
Flaris sits in the same performance tier as Lua - faster than CPython and QuickJS on compute-heavy workloads, and matching Lua on array-intensive benchmarks. First-class fiber concurrency, mandatory static analysis, and native C integration, with no external dependencies.
Compiles .fls source to compact .flx bytecode. Execute pre-compiled files for fast cold-start - compile once, deploy anywhere.
Lightweight fibers with async/await and cooperative scheduling. No threads, no data races - deterministic execution always.
A multi-pass analyzer (10 passes) catches type errors, unused variables, unreachable code, and flow issues before runtime.
Load native shared libraries at runtime and call C functions directly. Wrap performance-critical code in a thin C layer with full access to the VM API.
HTTP, JSON, Regex, Crypto, Graphics, File I/O, Networking, and more - batteries included without external dependencies.
Unsafe features (FFI, raw memory, eval) require the explicit -u flag. Any module import can be pinned to a SHA-256 fingerprint - if the bytecode doesn't match, the VM halts before execution. Production deployments stay locked down.
Compile on macOS, run on Linux ARM64 or Windows without recompiling. Portable .flx files run on any supported target.
Drop flarisvm into your C application. Script your game, tool, or server with a minimal surface area.
Borrows from JavaScript and C# - let/var, classes, lambdas, modules. Short adoption time from most modern languages.
Functions declared with fn hot compile to native ARM64 or x86-64 on first call. Loop-heavy math and array work runs > 10x faster than the interpreter - same source, add -j to enable.
SLAB allocator, SSO strings (≤15 chars inline), and compact bytecode keep heap pressure minimal. The full VM, compiler, and standard library weigh in around 1 MB - ideal for embedded targets and resource-constrained environments.
Annotate as much or as little as you want. The analyzer infers types where omitted and enforces them where declared. Null unions (string|nil) and null-coalescing (??) are built into the language.
flarispm installs packages from any git repository - no central registry needed. Written in Flaris itself. One command to add, compile, and import a library.
Code Examples
From classes to fibers, from HTTP to native FFI - a few patterns to get started.
class Animal { fn Constructor(n: string) { this.name = n; } fn Speak() { Console.WriteLine(this.name, " makes a sound."); } } class Dog : Animal { fn Constructor(n: string) { this.name = n; } fn Speak() { Console.WriteLine(this.name, " barks."); } } fn Main() { let d: instance = new Dog("Rex"); d.Speak(); // Rex barks. return; }
fn async fetch(id: int): int { Fiber.Sleep(id * 10); return id * id; } fn async Main() { // Spawn three fibers - they run cooperatively let a: fiber = fetch(3); let b: fiber = fetch(1); let c: fiber = fetch(2); // await collects each result Console.WriteLine(await a, await b, await c); // 9 1 4 return; }
import { Http } from library("Http", "1.0"); fn Main() { // Simple HTTP GET let resp = Http.Get("http://httpbin.org/json"); Console.WriteLine("status: ", resp.status); let data = Json.Parse(resp.body); Console.WriteLine(data.slideshow.title); // POST with JSON body let payload = Json.Stringify({ name: "Flaris", version: 1 }); let post = Http.Post("http://httpbin.org/post", payload, { "Content-Type": "application/json" }); Console.WriteLine("posted, status: ", post.status); return; }
fn divide(a: int, b: int): int { if (b == 0) throw(1, "division by zero"); return a / b; } fn Main() { try { Console.WriteLine(divide(100, 10)); // 10 Console.WriteLine(divide(100, 0)); // throws } catch (e) { Console.WriteLine("caught: ", e.Error); } finally { Console.WriteLine("cleanup"); } // Null coalescing let raw: string|nil = nil; let val: string|nil = raw ?? "default"; Console.WriteLine(val); // default return; }
// Tight numeric loops can compile to native ARM64 at runtime. // Mark the function with 'fn hot' and run with -j: // flarisvm -j compute.fls fn hot sum(n: int): int { var s: int = 0; for (var i: int = 0; i < n; i++) { s = s + i; } return s; } fn Main() { Console.WriteLine(sum(1000)); // 499500 return; } // Measured over 10 000 calls on Apple M-series: // interpreter 1502 ms // JIT 8 ms - ~180× faster // // The compiler analyzes type annotations to decide eligibility. // Only pure integer/float math with typed locals qualifies. // Everything else falls back to the interpreter transparently.
// Run: flarisvm --check app.fls // The static analyzer runs 9 passes and reports early: fn Main() { let x: int = "hello"; // ← error: type mismatch let y: int = 42; return; Console.WriteLine("unreachable"); // ← warning: dead code } // app.fls:4:24: 1000: Type mismatch for 'x' (expected compatible with declared type). // app.fls:8:35: 2006: Unreachable code.
Runnable .fls files - each covering a distinct language feature or use case.
Standard Library
Everything from JSON and cryptography to regex and compression is built in. No package manager required for the essentials.
Libraries
Install a library once into your per-user libs folder — ~/.flaris/libs on macOS and Linux, %USERPROFILE%\.flaris\libs on Windows — and import it by name from any script, no --libs flag needed. (You can also just drop a .flx next to a script for one-off use.) Each library ships source and pre-compiled bytecode. Libraries marked -u require the unsafe flag at runtime. Download the .fls source for inline documentation and usage examples.
-u flag.
pg_ffi.c and -u flag.
redis_ffi.c and -u flag.
-u flag.
sqlite_ffi.c and -u flag.
-u flag.
Downloads
One command installs flarisvm and flarispm and adds them to your PATH.
$ curl -fsSL https://www.flaris-lang.org/install.sh | sh
PS> iwr -useb https://www.flaris-lang.org/install.ps1 | iex
Installs to ~/.flaris/bin/ by default. Override with FLARIS_HOME=/your/path.
Or download individual binaries below.
# Download from www.flaris-lang.org/vsix/ then install from command line $ code --install-extension flaris-0.3.0.vsix # Or in VS Code: Extensions › ··· menu › "Install from VSIX..."
# Run your first program $ ./flarisvm hello.fls # Compile to bytecode, then execute $ ./flarisvm -c hello.fls hello.flx $ ./flarisvm -e hello.flx
Security
Flaris bytecode (.flx) carries an embedded Ed25519 signature.
The official standard library is signed with the Flaris signing key, and the matching
public key is compiled into the runtime as a trust anchor - so signed code verifies with
nothing to download or configure. A tampered .flx fails to load; run with
--require-signed to refuse anything not signed by a trusted key.
flaris-official b6e2237413be79854985a1d4650ddefca8bc9c517964e6b9814b887bc6b779be
This is the canonical reference. Confirm your install matches it: the key shown when you inspect a library, the key compiled into your runtime, and the value above should all be identical. If they agree, the artifact was signed by the official Flaris key.
# Inspect any .flx - the signer and trust status are in the header $ flarisvm -d ~/.flaris/libs/Jwt.flx Signature : Ed25519 (valid, trusted signer) Signed by : b6e2237413be79854985a1d4650ddefca8bc9c517964e6b9814b887bc6b779be # Enforce signatures: refuse unsigned or untrusted bytecode $ flarisvm --require-signed -e app.flx
valid, trusted signer means the embedded key matched a trusted key;
valid, untrusted signer means the signature is good but the key is not trusted
(add it to ~/.flaris/trusted_keys to trust a third-party publisher);
INVALID means the file was altered after signing.
Package Manager
flarispm is the official Flaris package manager - written entirely in Flaris itself.
Install libraries from any public or private git repository in one command.
No central registry. No build system. Just git, bytecode, and --libs.
flarispm ships as a single signed .flx - nothing else to download.
flarisvm verifies its flaris-lang.org signature on every run, so you can
trust it regardless of how it reached you. Run it with flarisvm -e flarispm.flx, or
add a short alias.
# Verify the download is the official, untampered build $ flarisvm --sig-info flarispm.flx signed|trusted|b6e2…79be|flaris-lang.org # macOS / Linux - alias so 'flarispm' just works $ mkdir -p ~/.flaris/bin && cp flarispm.flx ~/.flaris/bin/ $ echo "alias flarispm='flarisvm -e ~/.flaris/bin/flarispm.flx'" >> ~/.zshrc # Windows - doskey / a one-line .bat that calls: flarisvm -e flarispm.flx %* C:\> copy flarispm.flx C:\tools\flaris\
# Initialise a project manifest $ flarispm init # Add any package from GitHub (or any git host) $ flarispm add https://github.com/stefansolid/flaris-test-package # Run with the installed packages in scope $ flarisvm --libs='./flaris_packages' myapp.fls
import { Greet } from library("Greet", "1.0"); fn Main() { Greet.Hello("Stefan"); // Hello, Stefan! Greet.Shout("it works"); // IT WORKS!!! }
| flarispm init | Create flaris.json in current directory |
| flarispm add <url> [version] | Clone, compile and register a package |
| flarispm install | Install all dependencies from flaris.json |
| flarispm remove <url> | Remove a package and its compiled files |
| flarispm list | Show installed packages and their status |
| flarispm update [url] | Pull latest and recompile (all or one) |
| flarispm version | Print flarispm version |
Documentation
Full language specification, standard library reference, and FFI guide - all maintained alongside the source.
Read top-to-bottom introduction: variables, classes, fibers, async/await, and the module system.
Full CLI flags, type system spec, built-in functions, operator precedence, VM limits, and stdlib API tables.
Write C plugins, expose functions to Flaris, marshal types, and build high-performance native extensions.
Required header for building FFI plugins:
↓ ffi_object.h