Falx
A small, tree-walking scripting language, written in Python. Structs, closures, arrays and maps, with a syntax that stays close to C-family languages.
Hello, Falx
Every .flx file is a flat list of statements - no boilerplate, no main function required.
func greet = define(name = "world") {
return "Hello, " + name + "!";
}
output(greet());
output(greet("Falx"));
$ python -m src.Main run hello.flx
Hello, world!
Hello, Falx!
What's in the language
Everything below is implemented and tested on the master branch today.
Variables & types
let and const, plus numbers, strings, booleans, arrays, maps, tuples and null.
Closures
Functions are values. Nested func declarations close over their enclosing scope, including private state.
Structs
Fields with optional defaults, plus methods that read and mutate the instance's fields directly, no this needed.
Arrays & maps
Literal syntax and a set of built-in methods for both - push, sort, keys, contains and more.
Modules
require("name") loads another .flx file as a module, with circular-dependency detection.
Friendly diagnostics
Lexer, parser and runtime errors report a source location instead of a raw Python traceback.
Explore the docs
Language Guide
A page-by-page walkthrough of syntax and semantics, from variables to modules.
Reference
Built-in functions, every string/array/map method, keywords and grammar, in one place.
Tutorials
Four short, hands-on tutorials that build real (small) programs from scratch.
Example programs
Larger, real programs from the project's own test suite - a bank account manager, an inventory system and more.