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
6 changes: 4 additions & 2 deletions interactive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ You can write this as (it's one file, but broken up for exposition):
Although at the beginning, this can technically go anywhere in the root scope.
Here we just define some types, and the number and shapes of input collections.
The language is structurally typed, with collections containing non-recursive algebraic data types (sums, products, lists).
Enums are structural: variant names are for reading and erase, so two enums with the same lane shapes are the same type.
`type Name = shape;` declares an erased alias, usable in collection shapes and enum payloads, but not yet inside lambdas.

</details>
<p>
Expand All @@ -46,8 +48,8 @@ The language is structurally typed, with collections containing non-recursive al
-- groups contain users and other groups, and a block on a member
-- reaches everyone inside it.

type Access = Owner | Edit | View; -- decreasing levels of access
type Member = User int | Group int; -- a user, or group of members
enum Access = Owner | Edit | View; -- decreasing levels of access
enum Member = User int | Group int; -- a user, or group of members

let grants = input 0 : (int, (Member, Access)); -- doc -> (member, access)
let groups = input 1 : (int, Member); -- group id -> member
Expand Down
2 changes: 1 addition & 1 deletion interactive/examples/programs/adt.ddp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- carrying the field-sum as payload, then matched back out to a (bucket, sum)
-- and counted per bucket. (Contrived — exercises sum intro/outro + fold.)

type Dir = Fwd int -- src < dst
enum Dir = Fwd int -- src < dst
| Bwd int; -- otherwise

let edges = input 0 : ((int, int), ()) | map(((a, b), ()) -> (a, b));
Expand Down
2 changes: 1 addition & 1 deletion interactive/examples/programs/ast.ddp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--
-- Inputs may be any integers: corgi orders integers by their signed values, as DDIR does.

type Dir = Fwd int | Bwd int;
enum Dir = Fwd int | Bwd int;

let rows = input 0 : ((int, int), ()) | map(((a, b), ()) -> (a, b));

Expand Down
2 changes: 1 addition & 1 deletion interactive/examples/programs/binders.ddp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Depth-tracking test: a pattern binder `xs` used INSIDE a fold step. Correct
-- de Bruijn resolution => xs is the case payload at Bound(2) inside the fold;
-- a wrong index would hit the fold's Int element and panic on Proj.
type Node = Node List(int);
enum Node = Node List(int);

let rows = input 0 : ((int, int), ()) | map(((a, b), ()) -> (a, (a enlist, b enlist) append inject Node));

Expand Down
2 changes: 1 addition & 1 deletion interactive/examples/programs/tour.ddp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- fixtures under tests/programs/ pin individual lowerings and their fallback
-- routing; this program pins that the constructs work TOGETHER.

type Dir = Fwd int | Bwd int;
enum Dir = Fwd int | Bwd int;

let edges = input 0 : ((int, int), ()) | map(((a, b), ()) -> (a, b));
let roots = input 1 : ((int), ()) | map(((n), ()) -> (n, ()));
Expand Down
4 changes: 2 additions & 2 deletions interactive/examples/server/programs/access.ddp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- groups contain users and other groups, and a block on a member
-- reaches everyone inside it.

type Access = Owner | Edit | View; -- decreasing levels of access
type Member = User int | Group int; -- a user, or group of members
enum Access = Owner | Edit | View; -- decreasing levels of access
enum Member = User int | Group int; -- a user, or group of members

let grants = input 0 : (int, (Member, Access)); -- doc -> (member, access)
let groups = input 1 : (int, Member); -- group id -> member
Expand Down
2 changes: 1 addition & 1 deletion interactive/examples/server/programs/echo.ddp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Echoes input 0 to its output, so `inspect` shows whatever is fed — used to
-- demonstrate structured (ADT) values and time-scheduled input. Its rows are
-- values of a declared sum type.
type Node = Leaf int | Pair (int, int);
enum Node = Leaf int | Pair (int, int);
output "out" = input 0 : (Node, ()) | inspect(echo);
2 changes: 1 addition & 1 deletion interactive/server/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ mod tests {
/// A parser that has prepared a load of `world`, whose inputs are fed below.
fn world() -> LineParser {
let program = r#"
type T = A int | B int | C (int, int);
enum T = A int | B int | C (int, int);
output "pairs" = input 0 : ((int, int), ());
output "both" = input 1 : ((int, int), (int, int));
output "tagged" = input 2 : ((), T);
Expand Down
2 changes: 1 addition & 1 deletion interactive/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use crate::lambda::Lambda;
/// registered function may not take one as its name (`crate::lambda::register`). The lexer's own
/// table (`parse::pipe`) must agree, which its tests check.
pub(crate) const KEYWORDS: &[&str] = &[
"let", "var", "set", "output", "type", "input", "import", "map", "join", "min", "distinct", "count",
"let", "var", "set", "output", "type", "enum", "input", "import", "map", "join", "min", "distinct", "count",
"collect", "flatmap", "arrange", "negate", "filter", "inspect", "lift_iter",
];

Expand Down
2 changes: 1 addition & 1 deletion interactive/src/lambda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) mod normalize;
/// input is the tuple of the slot's rows (`(key, val)` for a linear op, `(key, left val, right
/// val)` for a join). The parser binds it where it is written, in the scope of its DDIR program:
/// the registered functions and the base words `call` reaches, and the program's
/// `type` declarations as enums. A parse error is kept, and reported where the program is compiled
/// `enum` declarations. A parse error is kept, and reported where the program is compiled
/// or run. A composed lambda's graph is authoritative: its readable `src` is
/// reconstructed from the component sources and may reparse to a different
/// graph, especially after masking. Serialization stores only `src` and
Expand Down
Loading
Loading