Language tooling
kolang
A foundation for a family of concatenative, functional, scope-delimited languages: DSCH, and in time a general-purpose language for systems programming.
#[test]
fn recognise_tokens() {
let mut cursor = Cursor::new("_exp#r");
let mut tok = cursor.advance_token();
assert_eq!(tok.kind, Ident);
assert_eq!(tok.len, 4);
assert_eq!(cursor.first(), '#');
tok = cursor.advance_token();
assert_eq!(tok.kind, Hash);
}kolang is the reset after DSCH. DSCH mostly worked, but each new feature took more effort to fit in without breaking the test programs. kolang is the strong foundation that should have come first: tooling for building a whole family of languages that share a paradigm, so their syntax and semantics can grow systematically rather than ad hoc.
The family
- A program is a composite function. Juxtaposition supplies the default semantics: put two expressions side by side and they compose, with no binding operator in between. It isn't stack-based.
- Delimited scopes change the context. In DSCH,
( … )evaluates expressions one after another and{ … }evaluates them together, so a brace of parenthesised sequences is lines of music played at once. - The same shapes, for software. The general-purpose language's cognates of those two scopes are synchronous and asynchronous code.
Where it is
Just begun, test-first: a hand-written lexer with its cursor and token tests. The plan is a pipeline of small, separate passes over explicit intermediate representations, with each backend (MIDI for DSCH, native code for the general-purpose language) behind a trait.
The repository is private for now.