Dana is a Graph-Oriented Programming Language designed for high-performance, predictable data-flow applications. Programs in Dana are defined as directed graphs where nodes represent processing units and edges represent data flow.
Dana embraces the philosophy that data flows through your program, making concurrency patterns explicit and eliminating hidden state mutations.
Logic is built by connecting nodes with typed edges (->). Data flows explicitly through ports, making program behavior predictable and easy to reason about.
process blocks with familiar expression syntax.System.IO, System.Kernel).All ports and properties are strictly typed (Int, Float, String, Bool, Byte, Unit/Impulse, Stream<T>, custom types) ensuring graph integrity at compile time.
Nodes with multiple inputs automatically synchronize—execution waits until all required inputs arrive before processing.
Full pattern matching support with literals, wildcards, variable bindings, tuple patterns, and guards.
match statements for branching based on input valuesA Dana program consists of graphs, nodes, and edges:
graph Main {
// Define nodes
node Greeter {
prefix: String = "Hello, "
in name: String
out message: String
process: (name) => {
emit message(prefix + name)
}
}
// Connect nodes with edges
Greeter.message -> System.IO.stdout
}
Nodes are the processing units of Dana. Each node has:
| Component | Description |
|---|---|
| Properties | Configuration values with defaults (e.g., prefix: String = "Hello") |
| Input Ports | Typed entry points for data (in name: String) |
| Output Ports | Typed exit points for data (out result: Int) |
| Process Block | Logic that transforms inputs to outputs |
node Calculator {
in a: Int
in b: Int
out sum: Int
out product: Int
process: (a, b) => {
emit sum(a + b)
emit product(a * b)
}
}
Edges connect output ports to input ports. Guards filter which values propagate:
// Simple edge
NodeA.output -> NodeB.input
// Guarded edge - only propagates when condition is true
Counter.value [value > 0] -> Processor.input
Counter.value [value <= 0] -> Terminal.done
Match expressions for complex branching:
node Router {
in command: Int
out small: String
out medium: String
out large: String
process: (command) => {
match command {
1 => emit small("one")
2 => emit medium("two")
n if n > 10 => emit large("big number")
_ => emit small("other")
}
}
}
Custom types can be defined (implemented but not fully tested):
type Point {
x: Float
y: Float
}
type Result<T> {
value: T
error: String
}
Graphs can be nested for modularity:
graph Main {
graph Subsystem {
node Internal { ... }
}
External.output -> Subsystem.Internal.input
}
Also, you can instantiate nodes outside graphs, and declare edges only in graphs:
node MyNode {
in foo : Int
out bar : Int
process : (foo) => {
emit bar(foo * 2)
}
}
node Constant {
out val : Int = 5
}
graph Main {
Constant.val -> MyNode.foo
MyNode.bar -> System.IO.stdout
}
Console I/O operations.
| Port | Type | Description |
|---|---|---|
stdout |
Any |
Prints value to console |
Runtime utility nodes for coordination and synchronization.
Accumulates values into a list and emits them on reset.
| Port | Direction | Type | Description |
|---|---|---|---|
in |
Input | Any |
Values to accumulate |
reset |
Input | Any |
Trigger to emit and clear |
send |
Output | List |
Emits accumulated list |
Waits for both inputs before emitting.
| Port | Direction | Type | Description |
|---|---|---|---|
a |
Input | Any |
First value |
b |
Input | Any |
Second value |
send |
Output | List |
Emits [a, b] when both arrive |
cargo build --release
# Run a Dana program
./target/release/dana-lang run examples/hello.dana
# Run with verbose debug output
./target/release/dana-lang --verbose run examples/factorial_iterative.dana
# Check syntax without running
./target/release/dana-lang check examples/math.dana
Use the provided PowerShell script for cross-platform development:
.\dana.ps1 build
.\dana.ps1 test
.\dana.ps1 run examples/hello.dana
| Example | Description |
|---|---|
hello.dana |
Basic "Hello World" with System.IO |
math.dana |
Arithmetic operations and expressions |
strings.dana |
String concatenation and properties |
while.dana |
Countdown loop demonstration |
factorial_iterative.dana |
Iterative factorial using edge guards |
match_basic.dana |
Pattern matching with multiple arms |
~> asynchronous edges with proper buffering semantics.Stream<T> types with backpressure handling.type declarations.Stream<T>.Type1 | Type2 for flexible port typing.type keyword for custom type definitions is parsed and represented in the AST, but not fully tested in runtime scenarios.~> syntax is parsed but currently executes synchronously.Dana is an experimental language exploring graph-oriented paradigms. Contributions are welcome in:
- Standard library extensions
- Runtime optimizations
- Documentation and examples
- Language design discussions
Last modified 17 February 2026