1 unstable release
Uses new Rust 2024
| 0.1.0 | Dec 14, 2025 |
|---|
#31 in #flow
4KB
80 lines
Flow
A programming language with JIT compilation, transpilation, and a language server.
What is Flow?
Flow is a compiled programming language that runs your code fast. It has:
- JIT compiler for quick execution
- AOT compiler for native binaries
- Transpiler to Java and other languages
- Language server for editor support
- Standard library with common tools
Quick Start
Install
git clone https://github.com/flowlangteam/flow
cd flow/flow_c
cargo build --release
The compiler will be at target/release/flow.
Run Your First Program
Create hello.flow:
func main() -> i64 {
return 42;
}
Run it:
flow run hello.flow
Usage
Run a program
flow run myfile.flow
Build to native binary
flow build myfile.flow -o myprogram
Transpile to Java
flow transpile myfile.flow -t java -o MyProgram.java
Check for errors
flow check myfile.flow
Start REPL
flow repl
Examples
Functions
func add(x: i64, y: i64) -> i64 {
return x + y;
}
func main() -> i64 {
return add(5, 3);
}
Loops
func main() -> i64 {
let mut sum = 0;
for i in 0..10 {
sum = sum + i;
}
return sum;
}
Structs
struct Point {
x: i64,
y: i64,
}
func main() -> i64 {
let p = Point { x: 10, y: 20 };
return p.x + p.y;
}
Editor Support
The language server provides:
- Syntax highlighting
- Error checking
- Code completion
- Go to definition
- Find references
- Hover information
Build the LSP server:
cd flow_c
cargo build --package flow_lsp --release
The binary will be at target/release/flow-lsp.
Java Interop
Flow can run on the JVM and call Java code. See interop/java/ for details.
Building
Requirements
- Rust toolchain (latest stable)
- Cargo
Build all components
cd flow_c
cargo build --release
Build specific component
cargo build --package flow_cli --release
cargo build --package flow_lsp --release
Testing
cd flow_c
cargo test
License
MIT License - see LICENSE for details.
Contributing
Issues and pull requests are welcome.