Osprey Flavors: Two Syntaxes, One Language
Osprey has two source flavors:
- Default (
.osp) uses braces,fn, named arguments and familiar calls. - ML (
.ospml) uses layout, curry-by-default functions and whitespace application.
Each flavor has its own parser and lowerer. Both produce
osprey_ast::Program before type checking, effect checking and code generation.
fn add(x) = fn(y) => x + y
add x y = x + y
The compiler tests these explicit-curry forms for AST equivalence. A Default
multi-parameter function, such as fn add(x, y), is intentionally different:
it accepts two arguments at once rather than returning a function.
ML layout and matching are available in runnable examples:
classify n =
match n
0 => "zero"
1 => "one"
_ => "many"
Flavor selection works per file through .osp or .ospml, a leading source marker, or --flavor for a single-file build. A project can mix both flavors and import across them.
Both flavors support effect, perform, handle and handler; see Effect Handlers You Can Call.
See the tested examples and language-flavor specification.