Directed, acyclic, topologically sorted
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ltdk de2dc7cb97 Initial commit 4 months ago
src Initial commit 4 months ago
.editorconfig Initial commit 4 months ago
.gitignore Initial commit 4 months ago
CHANGELOG.md Initial commit 4 months ago
Cargo.lock Initial commit 4 months ago
Cargo.toml Initial commit 4 months ago
LICENSE.md Initial commit 4 months ago
Makefile Initial commit 4 months ago
README.md Initial commit 4 months ago

README.md

dats

Directed, acyclic, topologically sorted

License

Available via the Anti-Capitalist Software License for individuals, non-profit organisations, and worker-owned businesses.

Planning

The idea here is to replace make with something that works better and suits my needs, inspired by Prolog.

Syntax ideas: sequent calculus version of prolog, except the sequents are reversed for readability.

# targets must be valid identifiers. that's the only requirement.
# declares "target" as a valid target
target.

# dependencies are declared using sequents, only reversed.
# below is equivalent to the sequent "three, four ⊢ one, two"
# which is equivalent to the proposition "(three ∧ four) → (one ∨ two)"
# which states that the targets one and two have dependencies three and four
one, two : three, four.

# note: new lines don't matter here; the period ends the rule
one, two :
three, four.

# sequents can be chained as a shorthand, but it's a bit hard to read.
# below is equivalent to "one, two : three, four." and "three, four : five, six."
# in the first sequent, we have "three *and* four",
# but in the second, we have "three *or* four".
one, two : three, four : five, six.

# negations are allowed by prefixing targets with @;
# this prevents orderings that could otherwise be valid.
# below is equivalent to sequent "three, ¬four ⊢ ¬one, two"
# which is equivalent to the proposition "(three ∧ ¬four) → (¬one ∨ two)"
@one, two : three, @four.

# negations simply forbid orderings of targets;
# the below simply says that "one" may not precede "two".
@one : two.

# and similarly, this states that "two" may not follow "one".
one : @two.

# order-only predicates can be created using negation;
# the below requires that two run after one,
# while not explicitly requiring two when running one.
@two : one.

# targets can be aliased for readability;
# below states that "three" is *always* equivalent to "one *and* two"
three = (: one, two).

# aliases can also be reversed to turn into dysjunctions:
# below states that "three" *always* equivalent to "one *or* two"
three = (one, two :).

# aliases may *not* contain both conjunctions and dysjunctions.
# four = (one, two : three). # syntactically valid, semantically invalid

# alias syntax may be used to get explicit conjunctions or dysjunctions,
# but it is not recommended to go without an alias:
(: one, two) : three, four.

# the left-hand-side is converted to dysjunctive normal form;
# the right-hand-side is converted to conjunctive normal form.

# triggers determine actual actions performed by targets;
# I'll fill in how you define them later,
# but it'll be a combination of something like
# "if file changed, do this code shit"
# the below says something (five, then six) should occur when the below portion of the DAG is encountered
one, two : three, four $ five, six.

# to run immediately after a target is encountered:
target : $ trigger.

# shorthand:
$target.

# when multiple triggers match for a given portion, the largest trigger is run;
# if multiple match, then an error occurs

# code is run based upon external linking with something something other file

# a question mark can be used to indicate generated targets:
one : ?gen(two, three).

# generated targets are defined similar to triggers:
?gen(one, two, *rest) = {
    code shit;
};

# generated targets can modify variable references, which then apply to later targets
?gen(one, &two) : ?gen(two).

# variables have lists and maps and stuff

# maybe add the cut from prolog? allow generating it in rules???

# maybe figure out how to declare internal targets, or explicitly declare external targets (allowed to be called from outside file)