fez-lisp 1.5.150 → 1.5.152
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 +1 -1
- package/lib/baked/std.js +1 -1
- package/package.json +2 -2
- package/src/compiler.js +0 -7
- package/src/interpreter.js +0 -16
- package/src/keywords.js +1 -2
- package/src/types.js +0 -30
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "fez-lisp",
|
3
3
|
"description": "Lisp interpreted & compiled to JavaScript",
|
4
4
|
"author": "AT290690",
|
5
|
-
"version": "1.5.
|
5
|
+
"version": "1.5.152",
|
6
6
|
"type": "module",
|
7
7
|
"main": "index.js",
|
8
8
|
"keywords": [
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"build": "node ./lib/builder.js",
|
26
26
|
"fez": "node main.js",
|
27
27
|
"test": "mocha",
|
28
|
-
"examples": "node ./examples/2015/test.spec.js && node ./examples/2019/test.spec.js && node ./examples/2020/test.spec.js && node ./examples/2023/test.spec.js && node ./examples/2024/test.spec.js"
|
28
|
+
"examples": "node ./examples/2015/test.spec.js && node ./examples/2019/test.spec.js && node ./examples/2020/test.spec.js && node ./examples/2021/test.spec.js && node ./examples/2023/test.spec.js && node ./examples/2024/test.spec.js"
|
29
29
|
},
|
30
30
|
"license": "MIT",
|
31
31
|
"devDependencies": {
|
package/src/compiler.js
CHANGED
@@ -53,7 +53,6 @@ const keywordToHelper = (name) => {
|
|
53
53
|
case STATIC_TYPES.ABSTRACTIONS:
|
54
54
|
case STATIC_TYPES.BOOLEANS:
|
55
55
|
case STATIC_TYPES.COLLECTIONS:
|
56
|
-
case DEBUG.ASSERT:
|
57
56
|
case DEBUG.LOG:
|
58
57
|
case DEBUG.STRING:
|
59
58
|
return '__identity'
|
@@ -132,7 +131,6 @@ const Helpers = {
|
|
132
131
|
__identity: `__identity=(x)=>x`,
|
133
132
|
atom_predicate: `atom_predicate=(number)=>+(typeof number==='number')`,
|
134
133
|
lambda_predicate: `lambda_predicate=(fn)=>+(typeof fn==='function')`,
|
135
|
-
__error: `__error=(error)=>{throw new Error(error.map((x)=>String.fromCharCode(x)).join(''))}`,
|
136
134
|
set_effect: `set_effect=(array,index,value)=>{array[index] = value;return array}`,
|
137
135
|
pop_effect: `pop_effect=(array)=>{array.pop();return array}`
|
138
136
|
}
|
@@ -279,10 +277,6 @@ const comp = (tree, Drill) => {
|
|
279
277
|
Drill
|
280
278
|
)}}return -1})();`
|
281
279
|
}
|
282
|
-
case KEYWORDS.ERROR: {
|
283
|
-
Drill.Helpers.add('__error')
|
284
|
-
return `__error(${compile(tail[0], Drill)})`
|
285
|
-
}
|
286
280
|
|
287
281
|
case STATIC_TYPES.ABSTRACTION:
|
288
282
|
case STATIC_TYPES.COLLECTION:
|
@@ -295,7 +289,6 @@ const comp = (tree, Drill) => {
|
|
295
289
|
case STATIC_TYPES.ABSTRACTIONS:
|
296
290
|
case STATIC_TYPES.BOOLEANS:
|
297
291
|
case STATIC_TYPES.COLLECTIONS:
|
298
|
-
case DEBUG.ASSERT:
|
299
292
|
case DEBUG.LOG:
|
300
293
|
case DEBUG.STRING:
|
301
294
|
return compile(tail[0], Drill)
|
package/src/interpreter.js
CHANGED
@@ -816,22 +816,6 @@ export const keywords = {
|
|
816
816
|
)
|
817
817
|
return +(typeof evaluate(args[0], env) === 'function')
|
818
818
|
},
|
819
|
-
[KEYWORDS.ERROR]: (args, env) => {
|
820
|
-
if (args.length !== 1)
|
821
|
-
throw new RangeError(
|
822
|
-
`Invalid number of arguments to (${KEYWORDS.ERROR}) (= 1 required) (${
|
823
|
-
KEYWORDS.ERROR
|
824
|
-
} ${stringifyArgs(args)})`
|
825
|
-
)
|
826
|
-
const expression = evaluate(args[0], env)
|
827
|
-
if (!Array.isArray(expression))
|
828
|
-
throw new TypeError(
|
829
|
-
`Argument of (${KEYWORDS.ERROR}) must be an (${
|
830
|
-
KEYWORDS.ARRAY_TYPE
|
831
|
-
}) but got (${expression}) (${KEYWORDS.ERROR} ${stringifyArgs(args)})`
|
832
|
-
)
|
833
|
-
throw new Error(expression.map((x) => String.fromCharCode(x)).join(''))
|
834
|
-
},
|
835
819
|
|
836
820
|
[STATIC_TYPES.UNKNOWN]: (args, env) => evaluate(args[0], env),
|
837
821
|
[STATIC_TYPES.ANY]: (args, env) => evaluate(args[0], env),
|
package/src/keywords.js
CHANGED
package/src/types.js
CHANGED
@@ -385,15 +385,6 @@ export const SPECIAL_FORM_TYPES = {
|
|
385
385
|
[RETURNS]: [COLLECTION]
|
386
386
|
}
|
387
387
|
},
|
388
|
-
[DEBUG.ASSERT]: {
|
389
|
-
[STATS]: {
|
390
|
-
[TYPE_PROP]: [APPLY],
|
391
|
-
[SIGNATURE]: DEBUG.ASSERT,
|
392
|
-
retried: Infinity,
|
393
|
-
[ARG_COUNT]: VARIADIC,
|
394
|
-
[RETURNS]: [UNKNOWN]
|
395
|
-
}
|
396
|
-
},
|
397
388
|
[DEBUG.SIGNATURE]: {
|
398
389
|
[STATS]: {
|
399
390
|
[TYPE_PROP]: [APPLY],
|
@@ -1266,27 +1257,6 @@ export const SPECIAL_FORM_TYPES = {
|
|
1266
1257
|
],
|
1267
1258
|
[RETURNS]: [ATOM, SPECIAL_BOOLEAN]
|
1268
1259
|
}
|
1269
|
-
},
|
1270
|
-
[KEYWORDS.ERROR]: {
|
1271
|
-
[STATS]: {
|
1272
|
-
[TYPE_PROP]: [APPLY],
|
1273
|
-
[SIGNATURE]: KEYWORDS.ERROR,
|
1274
|
-
retried: Infinity,
|
1275
|
-
[ARG_COUNT]: 1,
|
1276
|
-
[ARGUMENTS]: [
|
1277
|
-
{
|
1278
|
-
[STATS]: {
|
1279
|
-
retried: Infinity,
|
1280
|
-
[SIGNATURE]: PLACEHOLDER,
|
1281
|
-
[TYPE_PROP]: [COLLECTION],
|
1282
|
-
[RETURNS]: [COLLECTION],
|
1283
|
-
[ARGUMENTS]: [],
|
1284
|
-
[ARG_COUNT]: 0
|
1285
|
-
}
|
1286
|
-
}
|
1287
|
-
],
|
1288
|
-
[RETURNS]: [ANY]
|
1289
|
-
}
|
1290
1260
|
}
|
1291
1261
|
}
|
1292
1262
|
|