Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
MIT License
Pay It Forward License (PIF)

Copyright (c) 2026 spacedevin
Copyright (c) 2026-present spacedevin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This license includes a perpetual, worldwide, non-exclusive, royalty-free, irrevocable (except as stated below) grant for patent claims necessarily infringed by the use of the Software or any contributions submitted to it; terminating automatically when an entity initiates patent litigation (including a cross-claim or counterclaim) alleging that the Software or any portion thereof infringes a patent.

The software is provided "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.

Recipients of the Software should pay it forward by contributing to the open-source community through actions including but not limited to providing code, documentation, tutorials, guides, support, feedback, or promoting open-source projects through advocacy or related efforts that advance innovation and community growth.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,6 @@ any restricted host (via a profile). It is what makes drift a test failure rathe

Branch % is lower (~60%) because the Tish→JS emit adds many `?? null` / typeof guards that are defensive noise, not language logic. Line coverage is the gate in CI.

MIT
## License

Pay It Forward (PIF) — see [LICENSE](LICENSE). Same license as [tish](https://github.com/tishlang/tish).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"type": "module",
"description": ".deck language only \u2014 tokenize, parse, format, registries, highlight classify",
"license": "MIT",
"license": "PIF",
"author": "spacedevin",
"repository": {
"type": "git",
Expand Down
84 changes: 83 additions & 1 deletion scripts/build-rust.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,80 @@ fs.appendFileSync(
"\n// ── Typed facade (hand-written; see the deck repo's rust/facade.rs) ───────────\npub mod facade;\npub use facade::{parse, BarSelector, BodyRow, Clip, DeckProgram, Directive, GenBlock, Params, ParseError, Track};\n"
)


/// Rust-facing README. Deliberately not the npm one: a Rust consumer needs `parse()` and the typed
/// rows, not `npm install` and the Tish import path.
function crateReadme() {
return `# deckfile

Parser for the **\`.deck\`** patch language — the Rust target of [@spacedevin/deck][npm].

\`\`\`toml
[dependencies]
deckfile = "${CRATE_VERSION}"
\`\`\`

\`\`\`rust
let program = deckfile::parse(source);

println!("{:?} bpm", program.bpm);
for track in &program.tracks {
println!("{} ({}) — {} bars", track.name, track.generator_id, track.loop_bars.unwrap_or(1));
for row in &track.body {
match row {
deckfile::BodyRow::Note { midi, start_beat, dur_beats, .. } => { /* … */ }
deckfile::BodyRow::Steps { on, .. } => { /* … */ }
_ => {}
}
}
}
\`\`\`

\`parse\` never fails: malformed lines land in \`program.errors\`, because a streaming host has to be
able to parse a partial program.

## Generated — one source, three targets

Everything here except the typed facade is **generated** from the same \`src/index.tish\` that
produces the npm package, using \`tish build --target rust-lib\`. Rust, JavaScript and Tish consumers
therefore parse \`.deck\` identically by construction rather than by discipline, and a
[shared conformance corpus][conf] — the same \`.deck\` inputs with the same expected parses — is run
against every target on every change.

Don't send patches here; fix the language upstream in [spacedevin/deck][repo].

## Scope

Tokenize · parse to an AST · track/clip body lines as typed rows · format helpers · scale vocabulary ·
bar selectors · Euclidean fill · highlight classification · host registries.

**Not** included, by design: applying the AST to a project model, emitting \`.deck\` text, audio
engines, instrument catalogs. Those belong to the host — see [HOST.md][host].

Hosts extend the language through registries rather than forking it:
\`registerTopLevelStatement\`, \`registerBodyLineDialect\`, \`registerGenBlockDialect\`,
\`registerGeneratorIdAliases\`, \`registerBuiltinMacros\`.

## Docs

- [Language grammar][grammar] — the canonical \`.deck\` surface
- [Host integration][host] — boot order and what a host implements
- [gen_block extensions][ext] — dialect registration

## License

Pay It Forward (PIF) — see LICENSE. Same license as [tish][tish].

[npm]: https://www.npmjs.com/package/@spacedevin/deck
[repo]: https://github.com/spacedevin/deck
[conf]: https://github.com/spacedevin/deck/tree/main/conformance
[grammar]: https://github.com/spacedevin/deck/blob/main/docs/DECK_GRAMMAR.md
[host]: https://github.com/spacedevin/deck/blob/main/docs/HOST.md
[ext]: https://github.com/spacedevin/deck/blob/main/docs/DECK_EXTENSION.md
[tish]: https://github.com/tishlang/tish
`
}

// The crate runs the SAME corpus as the JS build — that is the whole point of emitting it from one
// source. Ship the fixtures inside the crate so `cargo test` works from a published copy too.
fs.mkdirSync(path.join(out, "tests"), { recursive: true })
Expand All @@ -79,11 +153,14 @@ const CRATE_VERSION = process.env.DECKFILE_VERSION ?? pkg.version
const manifestPath = path.join(out, "Cargo.toml")
let manifest = fs.readFileSync(manifestPath, "utf8")
const deps = `[dependencies]\ntishlang_runtime = "${RUNTIME_VERSION}"\n`
// `license-file`, not `license`: PIF is not an SPDX identifier, so an SPDX field would either be
// rejected or misreport the terms. Same approach tish itself uses.
manifest = `[package]
name = "${CRATE_NAME}"
version = "${CRATE_VERSION}"
edition = "2021"
license = "${pkg.license}"
license-file = "LICENSE"
readme = "README.md"
description = "${pkg.description}"
repository = "${pkg.repository.url}"
keywords = ["deck", "tish", "parser", "music"]
Expand All @@ -101,5 +178,10 @@ path = "src/lib.rs"
${deps}`
fs.writeFileSync(manifestPath, manifest)

// A published crate needs its own LICENSE and README in the package — crates.io renders the README
// on the crate page and cannot reach back into the repo for either.
fs.copyFileSync(path.join(root, "LICENSE"), path.join(out, "LICENSE"))
fs.writeFileSync(path.join(out, "README.md"), crateReadme())

const pubFns = (fs.readFileSync(libPath, "utf8").match(/^pub fn /gm) ?? []).length
console.log(`crate: ${CRATE_NAME} v${CRATE_VERSION} — ${pubFns} exported fns + typed facade`)
Loading