@dallaylaen/ski-interpreter 2.3.3 → 2.4.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.4.0] - 2026-03-06
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ - Remove Expr.freeOnly method, use `!this.any(e => !(e instanceof FreeVar || e instanceof App))` instead;
13
+ - Remove Expr.weight() function because it's too ambiguous, use `fold (...)` instead.
14
+ - Remove `{ Quest }` from exports, use `SKI.Quest` instead.
15
+ - Rename `ski.js quest-check` to `ski.js quest-lint` for clarity.
16
+
17
+ ### Added
18
+ - Rewrite the whole thing in TypeScript.
19
+
20
+ ### Fixed
21
+ - Avoid name clashes with existing variables in infer()
22
+ ([#15](https://github.com/dallaylaen/ski-interpreter/issues/15))
23
+
8
24
  ## [2.3.3] - 2026-03-01
9
25
 
10
26
  ### Changed
package/README.md CHANGED
@@ -99,9 +99,16 @@ npm install @dallaylaen/ski-interpreter
99
99
  * `--verbose` - Show all evaluation steps
100
100
  * Example: `ski file script.ski`
101
101
 
102
- * **`quest-check <files...>`** - Validate quest definition files
102
+ * **`extract <expression> <known term> ...`** -
103
+ Replace parts of the expression that are equivalent to the known terms with the respective terms. Known terms must be normalizable.
104
+
105
+ * **`search <expression> <known term> ...`** -
106
+ Attempt to brute force an equivalent of the _expression_ using only the _known terms_.
107
+ Only normalizing terms are currently supported.
108
+
109
+ * **`quest-lint <files...>`** - Validate quest definition files
103
110
  * `--solution <file>` - Load solutions from a JSON file for verification
104
- * Example: `ski quest-check quest1.json quest2.json --solution solutions.json`
111
+ * Example: `ski quest-lint quest1.json quest2.json --solution solutions.json`
105
112
 
106
113
  If no subcommand is provided, help is displayed.
107
114
 
package/bin/ski.js CHANGED
@@ -4,14 +4,15 @@ const fs = require('node:fs/promises');
4
4
  const { Command } = require('commander');
5
5
 
6
6
  const { SKI } = require('../lib/ski-interpreter.cjs');
7
- const { Quest } = require('../src/quest.js');
7
+ const { Quest } = SKI;
8
+ const { version } = require('../package.json');
8
9
 
9
10
  const program = new Command();
10
11
 
11
12
  program
12
13
  .name('ski')
13
14
  .description('Simple Kombinator Interpreter - a combinatory logic & lambda calculus parser and interpreter')
14
- .version('2.2.1');
15
+ .version(version);
15
16
 
16
17
  // REPL subcommand
17
18
  program
@@ -58,7 +59,7 @@ program
58
59
 
59
60
  // Quest-check subcommand
60
61
  program
61
- .command('quest-check <files...>')
62
+ .command('quest-lint <files...>')
62
63
  .description('Check quest files for validity')
63
64
  .option('--solution <file>', 'Load solutions from file')
64
65
  .action((files, options) => {
@@ -214,7 +215,7 @@ async function questCheck (files, solutionFile) {
214
215
  // Exit with appropriate code
215
216
  process.exit(hasErrors ? 1 : 0);
216
217
  } catch (err) {
217
- console.error('Error in quest-check:', err.message);
218
+ console.error('Error in quest-lint:', err.message);
218
219
  process.exit(2);
219
220
  }
220
221
  }
@@ -264,9 +265,11 @@ function extractExpression (targetStr, termStrs) {
264
265
 
265
266
  const replaced = expr.traverse(e => {
266
267
  const canon = e.infer().expr;
267
- for (const [lambda, term] of pairs) {
268
- if (canon.equals(lambda))
269
- return term;
268
+ if (canon) {
269
+ for (const [lambda, term] of pairs) {
270
+ if (canon.equals(lambda))
271
+ return term;
272
+ }
270
273
  }
271
274
  return null;
272
275
  });