eyelang 1.3.7 → 1.3.8
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 +3 -1
- package/package.json +1 -1
- package/playground.html +12 -0
- package/test/run-regression.js +44 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# eyelang
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/eyelang)
|
|
4
4
|
[](https://doi.org/10.5281/zenodo.20342331)
|
|
5
5
|
|
|
6
6
|
eyelang is a small rule engine for Prolog-style Horn clauses over ordinary terms, lists, arithmetic, strings, and finite search. The command-line executable is `eyelang`.
|
|
@@ -458,6 +458,8 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
458
458
|
| [`service-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/service-impact.pl) | Analyzes service impact over cyclic dependencies. | [`output/service-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/service-impact.pl) |
|
|
459
459
|
| [`sieve.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/sieve.pl) | Enumerates primes with a sieve-style program. | [`output/sieve.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/sieve.pl) |
|
|
460
460
|
| [`skolem-functions.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/skolem-functions.pl) | Generates deterministic functional terms. | [`output/skolem-functions.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/skolem-functions.pl) |
|
|
461
|
+
| [`socket-age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socket-age.pl) | Shows socket-declared age reasoning inputs and plugs. | [`output/socket-age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socket-age.pl) |
|
|
462
|
+
| [`socket-family.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socket-family.pl) | Shows socket-declared family-source inputs and ancestry rules. | [`output/socket-family.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socket-family.pl) |
|
|
461
463
|
| [`socrates.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socrates.pl) | Derives that Socrates is mortal. | [`output/socrates.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socrates.pl) |
|
|
462
464
|
| [`statistics-summary.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/statistics-summary.pl) | Computes population statistics for a sample. | [`output/statistics-summary.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/statistics-summary.pl) |
|
|
463
465
|
| [`sudoku.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/sudoku.pl) | Solves generic 9x9 Sudoku strings through the sudoku/2 builtin. | [`output/sudoku.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/sudoku.pl) |
|
package/package.json
CHANGED
package/playground.html
CHANGED
|
@@ -438,10 +438,12 @@
|
|
|
438
438
|
"ackermann",
|
|
439
439
|
"age",
|
|
440
440
|
"aliases-and-namespaces",
|
|
441
|
+
"alignment-demo",
|
|
441
442
|
"allen-interval-calculus",
|
|
442
443
|
"ancestor",
|
|
443
444
|
"animal",
|
|
444
445
|
"annotation",
|
|
446
|
+
"backward",
|
|
445
447
|
"basic-monadic",
|
|
446
448
|
"bayes-diagnosis",
|
|
447
449
|
"bayes-therapy",
|
|
@@ -452,12 +454,14 @@
|
|
|
452
454
|
"buck-converter-design",
|
|
453
455
|
"cache-performance",
|
|
454
456
|
"canary-release",
|
|
457
|
+
"cat-koko",
|
|
455
458
|
"clinical-trial-screening",
|
|
456
459
|
"collatz-1000",
|
|
457
460
|
"combinatorics-findall-sort",
|
|
458
461
|
"competitive-enzyme-kinetics",
|
|
459
462
|
"complex",
|
|
460
463
|
"complex-matrix-stability",
|
|
464
|
+
"composition-of-injective-functions-is-injective",
|
|
461
465
|
"context-association",
|
|
462
466
|
"control-system",
|
|
463
467
|
"cryptarithmetic-send-more-money",
|
|
@@ -479,13 +483,16 @@
|
|
|
479
483
|
"dijkstra-findall-sort",
|
|
480
484
|
"dijkstra-risk-path",
|
|
481
485
|
"dining-philosophers",
|
|
486
|
+
"dog",
|
|
482
487
|
"drone-corridor-planner",
|
|
483
488
|
"easter-computus",
|
|
484
489
|
"electrical-rc-filter",
|
|
485
490
|
"epidemic-policy",
|
|
491
|
+
"equivalence-classes-overlap-implies-same-class",
|
|
486
492
|
"eulerian-path",
|
|
487
493
|
"ev-range-worlds",
|
|
488
494
|
"exact-cover-sudoku",
|
|
495
|
+
"existential-rule",
|
|
489
496
|
"exoplanet-validation-worlds",
|
|
490
497
|
"expression-eval",
|
|
491
498
|
"family-cousins",
|
|
@@ -500,9 +507,12 @@
|
|
|
500
507
|
"gd-step-certified",
|
|
501
508
|
"gdpr-compliance",
|
|
502
509
|
"goldbach-1000",
|
|
510
|
+
"good-cobbler",
|
|
503
511
|
"gps",
|
|
504
512
|
"graph-reachability",
|
|
505
513
|
"gray-code-counter",
|
|
514
|
+
"greatest-lower-bound-uniqueness",
|
|
515
|
+
"group-inverse-uniqueness",
|
|
506
516
|
"hamiltonian-cycle",
|
|
507
517
|
"hamiltonian-path",
|
|
508
518
|
"hamming-code",
|
|
@@ -542,6 +552,8 @@
|
|
|
542
552
|
"service-impact",
|
|
543
553
|
"sieve",
|
|
544
554
|
"skolem-functions",
|
|
555
|
+
"socket-age",
|
|
556
|
+
"socket-family",
|
|
545
557
|
"socrates",
|
|
546
558
|
"statistics-summary",
|
|
547
559
|
"sudoku",
|
package/test/run-regression.js
CHANGED
|
@@ -185,6 +185,16 @@ why(
|
|
|
185
185
|
assertEqual(result.stderr, '', 'stderr');
|
|
186
186
|
},
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
name: 'README and playground cover every bundled example',
|
|
190
|
+
run: () => {
|
|
191
|
+
const examples = listExampleNames();
|
|
192
|
+
const readmeExamples = readmeCatalogExampleNames();
|
|
193
|
+
const playgroundExamples = playgroundExampleNames();
|
|
194
|
+
assertEqual(readmeExamples.join('\n'), examples.join('\n'), 'README example catalog');
|
|
195
|
+
assertEqual(playgroundExamples.join('\n'), examples.join('\n'), 'playground examples');
|
|
196
|
+
},
|
|
197
|
+
},
|
|
188
198
|
{
|
|
189
199
|
name: 'stdin input is accepted',
|
|
190
200
|
run: () => {
|
|
@@ -460,6 +470,40 @@ function runWhyLoose({ program, query }) {
|
|
|
460
470
|
return result;
|
|
461
471
|
}
|
|
462
472
|
|
|
473
|
+
function listExampleNames() {
|
|
474
|
+
return fs.readdirSync(path.join(root, 'examples'))
|
|
475
|
+
.filter((name) => name.endsWith('.pl'))
|
|
476
|
+
.map((name) => name.slice(0, -3))
|
|
477
|
+
.sort();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function readmeCatalogExampleNames() {
|
|
481
|
+
const readme = fs.readFileSync(path.join(root, 'README.md'), 'utf8');
|
|
482
|
+
const section = between(readme, '## Example catalog', '## Golden outputs, tests, and conformance');
|
|
483
|
+
return [...section.matchAll(/examples\/([A-Za-z0-9_-]+)\.pl/g)]
|
|
484
|
+
.map((match) => match[1])
|
|
485
|
+
.filter((name, index, names) => names.indexOf(name) === index)
|
|
486
|
+
.sort();
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function playgroundExampleNames() {
|
|
490
|
+
const html = fs.readFileSync(path.join(root, 'playground.html'), 'utf8');
|
|
491
|
+
const match = html.match(/const EXAMPLES = \[(.*?)\];/s);
|
|
492
|
+
if (match == null) throw new Error('playground EXAMPLES array not found');
|
|
493
|
+
return [...match[1].matchAll(/"([^"]+)"/g)]
|
|
494
|
+
.map((match) => match[1])
|
|
495
|
+
.sort();
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function between(text, startMarker, endMarker) {
|
|
499
|
+
const start = text.indexOf(startMarker);
|
|
500
|
+
if (start === -1) throw new Error(`${startMarker} not found`);
|
|
501
|
+
const contentStart = start + startMarker.length;
|
|
502
|
+
const end = text.indexOf(endMarker, contentStart);
|
|
503
|
+
if (end === -1) throw new Error(`${endMarker} not found`);
|
|
504
|
+
return text.slice(contentStart, end);
|
|
505
|
+
}
|
|
506
|
+
|
|
463
507
|
function runCli(args, options = {}) {
|
|
464
508
|
return spawnSync(process.execPath, [bin, ...args], {
|
|
465
509
|
cwd: root,
|