@dallaylaen/ski-interpreter 1.0.1 → 1.2.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 ADDED
@@ -0,0 +1,75 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.2.0] - 2025-12-14
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ - Remove `toString()` options, use `format()` instead.
13
+ - Make `needsParens()` private (should've been to begin with)
14
+ - Remove unused `renameVars()` method.
15
+ - Remove Expr.`toJSON()`
16
+
17
+ ### Added
18
+
19
+ - SKI: `toJSON()` now recreates declarations exactly, preserving named subexpressions.
20
+ - SKI: `declare()` / `bulkAdd()` methods to export/import term definitions.
21
+ - Expr: `format(options?)` method for pretty-printing expressions with various options: html, verbosity, custom lambdas, custom brackets etc.
22
+ - Expr: `subst(find, replace)` now works for any type of find except application and lambdas.
23
+ - Playground: permalinks now use #hash instead of a ?query string. (Old links still supported).
24
+ - Playground: togglable frames around subexpressions & variable/redex highlighting.
25
+
26
+ ## [1.1.0] - 2025-12-07
27
+
28
+ ### BREAKING CHANGES
29
+
30
+ - Expr: canonize() renamed to guess(), output semantics changed
31
+ & returns nothing for non-normalizable terms.
32
+ Always check `result.normal` to be true.
33
+ - Expr: wantsArgs() removed.
34
+ - Quest: LinearCase class replaced with PropertyCase
35
+ supporting boolean properties `normal`, `proper`, `discard`, `duplicate`,
36
+ `linear`, and `affine`, and numeric `arity`.
37
+
38
+ ### Added
39
+ - Expr: guess() method to normalize terms.
40
+ Returns an object with `normal`: boolean and `steps`:
41
+ number properties, as well as optional `expr`: Expr -
42
+ equivalent lambda expression; `arity`: number,
43
+ and other properties.
44
+ - Expr: replace(terms: Expr[], options: {}) replaces
45
+ subtrees with matching canonical form (if they have one).
46
+ - Expr: expect(expr: Expr, comment: string?) now handles coments like proper assertion.
47
+ - Quest: PropertyCase class for matching based on term properties.
48
+ - Proper changelog
49
+ - Lots of new quests at https://dallaylaen.github.io/ski-interpreter/quest.html
50
+
51
+ ### Fixed
52
+ - Expr: equals() and expect() handle aliases correctly.
53
+ - Expr: run() always executes at least 1 step.
54
+ - Quest: improve typedefs
55
+ - package.json: rely on `npx` instead of handwritten scripts, improve dev dependencies.
56
+
57
+ ## [1.0.1] - 2025-07-18
58
+
59
+ ### Fixed
60
+
61
+ - README.md
62
+
63
+ ## [1.0.0] - 2025-07-18
64
+
65
+ ### Added
66
+
67
+ - Parser
68
+ - B, C, I, K, S, W
69
+ - Church numerals
70
+ - Lambdas as `x -> expr`
71
+ - Declare new terms `foo = expr`
72
+ - Quest engine
73
+ - Basically everything
74
+
75
+
package/README.md CHANGED
@@ -130,6 +130,7 @@ REPL comes with the package as [bin/ski.js](bin/ski.js).
130
130
 
131
131
  * "To Mock The Mockingbird" by Raymond Smulian.
132
132
  * [combinator birds](https://www.angelfire.com/tx4/cus/combinator/birds.html) by [Chris Rathman](https://www.angelfire.com/tx4/cus/index.html)
133
+ * [Fun with combinators](https://doisinkidney.com/posts/2020-10-17-ski.html) by [@oisdk](https://github.com/oisdk)
133
134
 
134
135
  # License and copyright
135
136
 
package/bin/ski.js CHANGED
@@ -69,7 +69,7 @@ function runLine(onErr) {
69
69
  if (state.final && !options.q)
70
70
  console.log(`// ${state.steps} step(s) in ${new Date() - t0}ms`);
71
71
  if (options.v || state.final)
72
- console.log('' + state.expr.toString({terse: options.t}));
72
+ console.log('' + state.expr.format({terse: options.t}));
73
73
  if (state.final && expr instanceof SKI.classes.Alias)
74
74
  ski.add(expr.name, state.expr);
75
75
  }