@suss/datalog 0.33.1 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/index.cjs +515 -101
- package/dist/index.d.cts +121 -61
- package/dist/index.d.ts +121 -61
- package/dist/index.js +514 -101
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Part of [suss](https://github.com/nimbuscloud-ai/suss), which reads both sides of every call in a repository and says where the two disagree.
|
|
4
4
|
|
|
5
|
-
A small semi-naïve Datalog evaluator with stratified negation.
|
|
6
|
-
|
|
5
|
+
A small semi-naïve Datalog evaluator with stratified negation. suss
|
|
6
|
+
derives its program facts with it.
|
|
7
7
|
|
|
8
8
|
## Why suss ships a Datalog engine
|
|
9
9
|
|
|
10
|
-
Extraction keeps running into problems that are
|
|
11
|
-
which functions are reachable from an entry point
|
|
12
|
-
err` re-throw can
|
|
13
|
-
block throws, transitively
|
|
14
|
-
underlying route.
|
|
15
|
-
comes to a few lines you can check by reading them:
|
|
10
|
+
Extraction keeps running into problems that are *fixpoints*. One is
|
|
11
|
+
which functions are reachable from an entry point. Another is what a
|
|
12
|
+
bare `throw err` re-throw can raise, which is the union of everything
|
|
13
|
+
the `try` block throws, transitively. A third is how a wrapper of a
|
|
14
|
+
wrapper resolves to its underlying route. Written as rules over base facts,
|
|
15
|
+
each one comes to a few lines you can check by reading them:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
import { Database, evaluate, lit, rule, variable as v } from "@suss/datalog";
|
|
@@ -34,16 +34,16 @@ evaluate(db, [
|
|
|
34
34
|
db.facts("reachable"); // [["main"], ["helper"], ["util"]]
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
Negation (`notLit`) is *stratified*: a rule set
|
|
39
|
-
a hard error at evaluation time
|
|
40
|
-
on its own without thinking about the engine.
|
|
37
|
+
The engine guarantees termination and soundness, and those are proved
|
|
38
|
+
once, for the engine. Negation (`notLit`) is *stratified*: a rule set
|
|
39
|
+
with a negation cycle is a hard error at evaluation time. Because of
|
|
40
|
+
that, you can check a rule on its own without thinking about the engine.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
Rules are plain data, without DSL strings or embedded code, so the same
|
|
43
|
+
rule set can later run on a faster external engine. An analysis written
|
|
44
|
+
against a set of facts (`calls`, `throws`, `handles`, and so on) does
|
|
45
|
+
not depend on the language. A second language adapter only has to emit
|
|
46
|
+
the same facts.
|
|
47
47
|
|
|
48
48
|
## More
|
|
49
49
|
|