marigold 0.1.17

The Marigold Programming Language.
Documentation

Marigold

crates.io docs.rs website lines of code contributors bench tests style wasm last commit onboarding

Marigold is an imperative, domain-specific language for data pipelining and analysis using async streams. It can be used as a standalone language or within Rust programs.

use marigold::m;

let odd_digits = m!(
  fn is_odd(i: &i32) -> bool {
    i.wrapping_rem(2) == 1
  }

  range(0, 10)
    .filter(is_odd)
    .return
).await.collect::<Vec<_>>();

println!("{:?}", odd_digits); // [1, 3, 5, 7, 9]

Quickstart

Install

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/DominicBurkart/marigold/main/install.sh | sh

Or via cargo:

cargo install marigold -F cli

Or from source:

git clone https://github.com/DominicBurkart/marigold.git
cd marigold
cargo install --path marigold -F cli

Hello World

Create hello_world.marigold:

range(0, 5).write_file("/dev/stdout", csv)

Run it:

marigold run hello_world.marigold

Output:

0
1
2
3
4

Static Analysis

Marigold can statically analyze your program's complexity:

marigold analyze hello_world.marigold
{
  "streams": [
    {
      "description": "input.write_file(...)",
      "cardinality": "5",
      "time_class": "O(n)",
      "exact_time": "O(n)",
      "space_class": "O(1)",
      "exact_space": "O(1)",
      "collects_input": false
    }
  ],
  "program_time": "O(n)",
  "program_exact_time": "O(n)",
  "program_space": "O(1)",
  "program_exact_space": "O(1)",
  "program_cardinality": "5"
}

Runtimes

By default, Marigold works in a single future and can work with any runtime.

The tokio and async-std features allow Marigold to spawn additional tasks, enabling parallelism for multithreaded runtimes.

Marigold supports async tracing, e.g. with tokio-console.

Platforms

Marigold's CI builds against aarch64, arm, WASM, and x86 targets, and builds the x86 target in mac and windows environments.