Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

789 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flow

A language for systems that evolve through time

Docs · Getting started · Galleries · Vision · Discord · Contributing

CI Docs Release License: MIT Discord

Source lines Standard library Examples Tests

Flow is a statically typed, compiled language with algebraic effects, autodiff in the stdlib, dynamics and control analysis, and native graphics. You write how a system evolves; that description is what runs.

Version 0.10.0
Install brew tap flooooooooooow/flow && brew install flow
License MIT
Cite CITATION.cff
function main() -> i32 {
    println("Hello, Flow!")
    return 0
}
flow run hello.flow

Why Flow

Most languages are built around computation: sequences of instructions that transform inputs to outputs.

Flow is built around evolution. You describe how a system changes through time. That description is what runs.

An engineer working on a physical system today crosses Python for analysis, MATLAB for controller design, Simulink for block diagrams, C/C++ for deployment, Verilog for hardware, and vendor tools for the rest. Every handoff loses information. The mathematical model drifts from the deployed code.

Flow collapses those boundaries. The model is the program. The compiler understands units, sample rates, timing contracts, memory topology, and numeric precision as part of the type system, and emits portable C by default.

flow Pendulum {
    state angle: f64 = 0.5
    state velocity: f64 = 0.0
    param damping: f64 = 0.3

    angle evolves as velocity
    velocity evolves as -9.81 * sin(angle) - damping * velocity
}

That is a complete program. The compiler hands the right-hand side to an RK4 solver and runs it at native speed. No notebook, no glue code, no translation step between model and deployment.

Full thesis: VISION.md. Domain architecture: docs/vision/physical-systems.md.


What you get

  • Dynamical systems, controllers, and simulations in one language (VISION).
  • Algebraic effects so you can swap I/O and other handlers without rewriting call sites.
  • Forward and reverse autodiff helpers in the stdlib; ML demos train on CPU in seconds.
  • C backend by default (no LLVM required). MLIR, WASM, and Metal when you need them.
  • Games, morphogenesis, neurodynamics, and real-time DSP as ordinary examples under examples/.

Installation

Homebrew

brew tap flooooooooooow/flow
brew install flow
flow version
flow run examples/basics/hello_world.flow

Track main with brew install --HEAD flow. Formula: packaging/homebrew.

From source

git clone https://github.com/flooooooooooow/flow.git
cd flow
./flow run examples/basics/hello_world.flow

Needs Python 3.9+ and Clang or GCC (Xcode Command Line Tools on macOS).

Optional: ./flow install puts flow on your PATH (~/.local/bin).

Longer walkthrough: Getting started.


Examples

Each GIF is a recording of the compiled program. Frames come from the real gfx backend.

Games
Snake Asteroids Breakout
Snake Asteroids Breakout
Flappy Invaders Pong
Flappy Invaders Pong
Morphogenesis
Gray-Scott Turing spots Diffusion-limited aggregation
Gray-Scott Turing spots Diffusion-limited aggregation
L-system tree Slime mold Sandpile
L-system tree Slime mold Sandpile
Neurons and networks
Hodgkin-Huxley Izhikevich zoo Balanced network
Hodgkin-Huxley Izhikevich zoo Balanced network
Evolutionary biology
Lotka-Volterra Wright-Fisher Red Queen
Lotka-Volterra Wright-Fisher Red Queen
Spatial SIR Hawk-Dove Rock-paper-scissors
Spatial SIR Hawk-Dove Rock-paper-scissors
Planet
Biomes Tectonics Erosion
Biomes Tectonics Erosion
Procedural generation
Wavefunction dungeon Voronoi sites Heightmap fBm
Wavefunction dungeon Voronoi sites Heightmap fBm
3D
Voxel world FPS camera Physics 3D
Voxel world FPS camera Physics 3D
Numerical and social
Adaptive FMM Voter model Majority rule
Adaptive FMM Voter model Majority rule
./flow gfx examples/games/tetris_gfx.flow
./flow gfx examples/evolution/lorenz_gfx.flow
./flow run examples/ml/models/mlp_xor.flow
./flow gfx examples/morphogenesis/gray_scott.flow
./flow gfx examples/neuro/hodgkin_huxley.flow
./flow gfx examples/evoleco/lotka_volterra_gfx.flow
./flow gfx examples/planet/planet_biomes.flow
./flow gfx examples/procgen/wfc_dungeon.flow
./flow gfx examples/threed/voxel_world.flow
Domain Gallery Index
Games (24) demos examples/games
Morphogenesis demos examples/morphogenesis
Neurons and networks demos examples/neuro
Evolutionary biology demos examples/evoleco
AI / ML training tutorials examples/ai, examples/ml

Entrypoints by domain: examples/README.md.


Language at a glance

Core syntax

let x: i32 = 42              # Immutable
let mut counter: i32 = 0     # Mutable

function add(a: i32, b: i32) -> i32 {
    return a + b
}

struct Point { x: f32, y: f32 }

if x > 0 { ... } elif x < 0 { ... } else { ... }
while condition { ... }
for i in 0 to 10 { ... }

Types

Primitives:  i32, i64, f32, f64, bool, string, void
Pointers:    ptr<T>, ptr<void>
Arrays:      array<T, N>
Generics:    function identity<T>(x: T) -> T

Algebraic effects

effect Logger {
    log(msg: string) -> void
}

capability ConsoleLogger {
    effect Logger
    function log(msg: string) -> void {
        println(msg)
    }
}

Walkthrough: docs/effects-showcase.md · examples/effects/showcase.flow.

Automatic differentiation

Forward-mode dual numbers and reverse helpers live in the stdlib (lib/stdlib/autodiff.flow). The XOR tourist demo trains via checked-in grad codegen in examples/ml/models/mlp_xor.flow. Compiler-integrated loss.grad is still on the roadmap.

FFI

extern {
    function malloc(size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
}

Documentation

Resource Description
Getting started Install, first program, basics
Best practices Idioms and why Flow favors fluid abstraction
Language overview Features and design
Language spec Full reference
Effects showcase Algebraic effects end to end
Examples index Demos by domain
Examples status Compile status of every example
Vision Why Flow exists
Roadmap Near-term work
Changelog Version history
Self-hosting Stage-A flowc in compiler/
Security · Conduct · Governance Project policy

Site: flooooooooooow.github.io/flow


Project layout

Path Contents
flow CLI entry point
src/flow/ Python-host compiler (parser, type checker, C/MLIR/Metal backends)
compiler/ Self-hosted Stage-A flowc
lib/stdlib/ Standard library
runtime/ Native runtime (graphics, audio, recording)
examples/ Domain demos and verify corpus
tests/ Language and stdlib tests
apps/ Applications (flowdb, flow-http, …)
benchmarks/ Microbenchmarks and harness
docs/ Spec, tutorials, demos, project docs
third_party/integrations/vscode/ VS Code / Cursor extension
site/ Wiki shell and site assets

Build and develop

./flow run <file>              # Compile and run (default host: flowc)
./flow compile <file>          # Compile only → build/
FLOW_HOST=python ./flow run <file>   # Full Python-host language surface
./flow test                    # Test suite (strict by default)
./flow test --strict --tier2   # + transpile / clang compile checks
./flow fmt <file>              # Format
./flow repl                    # Interactive mode
./flow lsp                     # Language server
./flow gfx <file>              # Compile and run with graphics
./flow mlir <file>             # Emit MLIR (requires LLVM/MLIR tools)

Host switch: FLOW_HOST=flowc|python|auto (default flowc for run / compile).

# Fuzz the compiler
python3 tests/fuzz/run_fuzz.py --seconds 30

# Regenerate examples compile-status table
python3 scripts/verify_examples.py

Editor support

./scripts/publish_vscode_extension.sh --install
# Or: cursor --install-extension quilio.flow-language

Extension source: third_party/integrations/vscode/flow-language/.

Python wheels from Flow

./flow python mylib.flow --name mylib
pip install dist/mylib-*.whl

Details: docs/python-target.md.

Compiler pipeline

Flow source → Parser → AST → C / MLIR / Metal → Clang / LLVM / shaders

Project statistics

Counted from tracked files by CI so the numbers match the tree.

Metric Files / modules Physical lines
Tracked source 2,837 391,184
Flow language 1,972 207,090
Python compiler (src/flow) 61 46,695
Self-hosted compiler (compiler/src) 17 10,863
Standard library modules 106 32,172
Native runtime 41 7,105
Examples (excluding verify corpus) 403 111,845
Verify corpus 1,078 18,715
Tests (.py + .flow) 346 38,367
Application programs 8 1,537
Registry packages 19
Documentation pages 138 30,536
Tracked source by language
Language Files Physical lines
Flow 1,972 207,090
Python 306 102,086
HTML 171 28,924
C 94 14,145
C/C++ headers 46 10,968
C++ 23 9,414
JavaScript 146 7,167
Shell 52 5,416
CSS 11 3,448
Objective-C 4 1,266
Objective-C++ 2 654
Rust 10 606

Generated by CI from tracked files at fa4cd677960f. Proof documents: 1,080. Raw JSON · Flow counter · Python fallback.


Contributing

Flow is built with humans directing design and agents writing a lot of the code. See CONTRIBUTING.md for decision authority and how to land changes.

Priorities: ROADMAP.md · docs/NEXT.md.


License

MIT. See LICENSE.


Flowy the Hedgehog, the Flow mascot
Made with care by humans and AI · mascot: Flowy the Hedgehog

About

Flow — a statically typed language for systems that evolve through time (effects, autodiff, C/MLIR)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages