Skip to content
HihahehoPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Sheet

Sheet-lang is a typed dataflow language for node sheets. A sheet is a graph of nodes; each node holds a formula (Excel-style functions on typed values) or a small program, and the nodes' outputs feed other nodes' inputs. Sheet-lang checks types and units, runs the graph incrementally, and keeps going when part of the input is not known yet.

Status: experimental. The syntax, the IR and the stored workspace format may change without notice. All crates are publish = false for now.

input 売上: Table<地域: Text, 金額: Int>
let 東 = query {
  from 行 in 売上
  where 行.地域 = "東"
}
output n = ROWS(東)
fn factorial(n: Int) -> Int { if n <= 1 { 1 } else { n * factorial(n - 1) } }
factorial(10)

Features

  • Excel-compatible built-ins (SUM, MAP, REDUCE, dates, text, lookup, statistics, finance) next to ordinary fn, let, var, while and for.
  • Static types with units, decimals, vectors, tables and relations; query blocks over tables.
  • Algebraic effects (effect, perform, handle … with) for errors, inputs and requests.
  • Holes: a value that is not known yet (?x) is carried through, so a run reports what it could compute and what it still waits for.
  • Rules and search: logic { … } with objectives, evaluated by derive or solve.
  • Incremental, budgeted and cancellable evaluation.

Crates

Crate Role
sheet-lang-parol grammar (sheet.par), generated parser, syntax tree and syntax errors
sheet-lang-model types, units, decimals, values, IR, stable ids, node graph and workspace
sheet-lang-compiler incremental compiler on query-flow: name resolution, type checking, lowering, editor services
sheet-lang-runtime IR interpreter, standard library, incremental and cancellable evaluation on whale
sheet-lang-test-suite Eure case files that specify what the parser, checker, evaluator and editor services answer

Build and test

The toolchain is pinned in rust-toolchain.toml (a nightly; rustup installs it on first use).

cargo test --locked --workspace
cargo test -p sheet-lang-test-suite --test cases -- <filter>   # run matching cases
cargo clippy --workspace --all-targets --locked -- -D warnings

The behaviour of the language is specified by the case files under crates/sheet-lang-test-suite/cases/ (syntax, types, eval, editor). To add a behaviour, add a case there.

Parser generation

The parser is generated from crates/sheet-lang-parol/sheet.par by parol and committed under crates/sheet-lang-parol/src/generated/. parol runs only in tools/sheet-lang-parol-gen, a workspace of its own with its own lockfile.

bash scripts/generate-sheet-lang-parol.sh          # regenerate
bash scripts/generate-sheet-lang-parol.sh --check  # fail if the committed files are stale

Supply chain

  • .cargo/config.toml refuses crate versions published less than 14 days ago (enforced by the nightly Cargo pinned in rust-toolchain.toml).
  • .gitignore is an allowlist: everything is ignored unless allowed. Check it when you add a new kind of file.

License

Licensed under either of

at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages