@fraczak/k 5.1.0 → 5.1.2

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.
@@ -9,11 +9,11 @@ function is_result_code(code) {
9
9
  }
10
10
  }
11
11
 
12
- t('true', is_result_code('bool'));
13
- t('false $bool', is_result_code('bool'));
14
- t('1', is_result_code('int'));
15
- t('12 $int', is_result_code('int'));
16
- t('"ala"', is_result_code('string'));
17
- t('"a" $string', is_result_code('string'));
12
+ t('true', is_result_code('@bool'));
13
+ t('false $@bool', is_result_code('@bool'));
14
+ t('1', is_result_code('@int'));
15
+ t('12 $@int', is_result_code('@int'));
16
+ t('"ala"', is_result_code('@string'));
17
+ t('"a" $@string', is_result_code('@string'));
18
18
 
19
- t('${} true $bool 1 $int "a" $string', is_result_code('string'));
19
+ t('${} true $@bool 1 $@int "a" $@string', is_result_code('@string'));
@@ -11,12 +11,12 @@ $b {1 one, () two, () c} .one
11
11
  const {input,output} = in_out(annotated);
12
12
  // console.log({input,output});
13
13
  assert.equal(input.type, annotated.representatives["b"]);
14
- assert.equal(output.type, "int");
14
+ assert.equal(output.type, "@int");
15
15
  console.log("OK");
16
16
  });
17
17
 
18
18
  t(`
19
- $a = < int true, bool false > ;
19
+ $a = < @int true, @bool false > ;
20
20
  $a .true
21
21
  `, (annotated) => {
22
22
  const {input,output} = in_out(annotated);
@@ -35,6 +35,6 @@ t(`
35
35
  const {input,output} = in_out(annotated);
36
36
  console.log({input,output});
37
37
  assert.equal(input.pattern, '(...)');
38
- assert.equal(output.type, "bool");
38
+ assert.equal(output.type, "@bool");
39
39
  console.log("OK");
40
40
  });
@@ -8,12 +8,12 @@ t('[]', (annotated) => {
8
8
  console.log("OK");
9
9
  });
10
10
 
11
- t("$int [ $int true, false ] .0", (annotated) => {
11
+ t("$@int [ $@int true, false ] .0", (annotated) => {
12
12
  const {input,output} = in_out(annotated);
13
- assert.equal(input.type, "int");
14
- assert.equal(output.type, "bool");
13
+ assert.equal(input.type, "@int");
14
+ assert.equal(output.type, "@bool");
15
15
  console.log("OK");
16
16
  });
17
17
 
18
- assert.throws(() => t(`$int [ $int true, 12 ]`), /Error/);
18
+ assert.throws(() => t(`$@int [ $@int true, 12 ]`), /Error/);
19
19
  console.log("OK");
package/codes.mjs CHANGED
@@ -9,7 +9,7 @@ const unitCode = function() {
9
9
  }();
10
10
 
11
11
  function isBuiltIn(code) {
12
- return code.match(/^(int|string|bool)$/);
12
+ return code.match(/^@(int|string|bool)$/);
13
13
  }
14
14
 
15
15
  function encodeCodeToString(code, codes = theRepository.codes) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@fraczak/k",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "k-language for JSON-like data transformation",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
7
7
  "prepare": "jiwson -m es6 parser.jison -o parser.mjs",
8
- "test": "node test.mjs; for f in Code-derivation-tests/*.mjs; do echo $f; node $f; done; node test-fingerprint.mjs"
8
+ "test": "node test.mjs; for f in Code-derivation-tests/*.mjs; do echo $f; node $f; done; node test-fingerprint.mjs; ./tests.sh"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
package/parser.jison CHANGED
@@ -120,7 +120,7 @@ defs: { }
120
120
 
121
121
  code
122
122
  : name { $$ = { code: "ref", ref: $1.value, start: $1.start, end: $1.end}; }
123
- | AT name { $$ = { code: "ref", ref: "@" + $2.value, start: $1.start, end: $2.end}; }
123
+ | AT name { $$ = { code: "ref", ref: "@" + $2.value, start: $1.start, end: $2.end}; }
124
124
  | codeDef { $$ = $1; }
125
125
  ;
126
126
 
@@ -218,6 +218,7 @@ exp
218
218
  | lb list rb { $$ = {op: "vector", vector: $2, start: $1.start, end: $3.end}; }
219
219
  | la list ra { $$ = {...union($2), start: $1.start, end: $3.end}; }
220
220
  | name { $$ = {op: "ref", ref: $1.value, start: $1.start, end: $1.end}; }
221
+ | AT name { $$ = {op: "ref", ref: "@" + $2.value, start: $1.start, end: $2.end}; }
221
222
  | lp rp { $$ = {...identity, start: $1.start, end: $2.end}; }
222
223
  | lp comp rp { $$ = {...$2, start: $1.start, end: $3.end }; }
223
224
  | str { $$ = {op: "str", str: $1.value, start: $1.start, end: $1.end }; }
package/parser.mjs CHANGED
@@ -115,12 +115,12 @@ function fromEscString(escString) {
115
115
 
116
116
 
117
117
  var parser = (function(){
118
- var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[4,6,8,10,12,14,16,30,38,40,63],$V1=[1,10],$V2=[1,25],$V3=[1,26],$V4=[1,23],$V5=[1,21],$V6=[1,22],$V7=[1,24],$V8=[1,27],$V9=[1,11],$Va=[1,28],$Vb=[1,20],$Vc=[1,31],$Vd=[4,6,8,10,12,14,16,30,38,40,47,60,63],$Ve=[2,68],$Vf=[1,35],$Vg=[1,38],$Vh=[4,6,8,10,12,14,16,18,20,22,24,30,32,34,38,40,47,60,63],$Vi=[2,89],$Vj=[1,56],$Vk=[2,71],$Vl=[2,72],$Vm=[4,6,8,10,12,14,16,18,20,22,24,30,32,34,36,38,40,47,60,63],$Vn=[4,6,8],$Vo=[2,27],$Vp=[4,6,8,10,12,14,16,18,20,22,24,26,30,32,34,38,40,47,60,63],$Vq=[2,33],$Vr=[1,82],$Vs=[1,84],$Vt=[20,32],$Vu=[4,6,8,10,12,14,16,30,38,40,60,63],$Vv=[1,89],$Vw=[1,93],$Vx=[18,22,32],$Vy=[1,96],$Vz=[2,50],$VA=[2,51],$VB=[1,108],$VC=[18,20,32],$VD=[2,83],$VE=[2,84],$VF=[2,85],$VG=[18,20,24,32];
118
+ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[4,6,8,10,12,14,16,30,38,40,50,63],$V1=[1,10],$V2=[1,26],$V3=[1,27],$V4=[1,24],$V5=[1,22],$V6=[1,23],$V7=[1,25],$V8=[1,28],$V9=[1,11],$Va=[1,29],$Vb=[1,15],$Vc=[1,21],$Vd=[1,32],$Ve=[4,6,8,10,12,14,16,30,38,40,47,50,60,63],$Vf=[2,68],$Vg=[1,36],$Vh=[1,39],$Vi=[4,6,8,10,12,14,16,18,20,22,24,30,32,34,38,40,47,50,60,63],$Vj=[2,90],$Vk=[1,58],$Vl=[2,72],$Vm=[2,73],$Vn=[4,6,8,10,12,14,16,18,20,22,24,30,32,34,36,38,40,47,50,60,63],$Vo=[4,6,8],$Vp=[2,27],$Vq=[4,6,8,10,12,14,16,18,20,22,24,26,30,32,34,38,40,47,50,60,63],$Vr=[2,33],$Vs=[1,84],$Vt=[1,86],$Vu=[20,32],$Vv=[4,6,8,10,12,14,16,30,38,40,50,60,63],$Vw=[1,91],$Vx=[1,95],$Vy=[18,22,32],$Vz=[1,98],$VA=[2,50],$VB=[2,51],$VC=[1,110],$VD=[18,20,32],$VE=[2,84],$VF=[2,85],$VG=[2,86],$VH=[18,20,24,32];
119
119
  var parser = {trace: function trace () { },
120
120
  yy: {},
121
121
  symbols_: {"error":2,"name":3,"NAME":4,"str":5,"STRING":6,"int":7,"INT":8,"la":9,"LA":10,"lc":11,"LC":12,"lb":13,"LB":14,"lp":15,"LP":16,"ra":17,"RA":18,"rc":19,"RC":20,"rb":21,"RB":22,"rp":23,"RP":24,"eq":25,"EQ":26,"dots":27,"DOTS":28,"dot":29,"DOT":30,"comma":31,"COMMA":32,"sc":33,"SC":34,"col":35,"COL":36,"dollar":37,"DOLLAR":38,"qmark":39,"QMARK":40,"incremental":41,"INCREMENTAL":42,"input_with_eof":43,"initialize_symbol_table":44,"defs":45,"comp":46,"EOF":47,"codeDef":48,"code":49,"AT":50,"labelled_codes":51,"non_empty_labelled_codes":52,"code_label":53,"filter_":54,"labelled_filters":55,"filter":56,"non_empty_labelled_filters":57,"filter_label":58,"exp":59,"CARET":60,"labelled":61,"list":62,"PIPE":63,"non_empty_labelled":64,"comp_label":65,"non_empty_list":66,"$accept":0,"$end":1},
122
122
  terminals_: {2:"error",4:"NAME",6:"STRING",8:"INT",10:"LA",12:"LC",14:"LB",16:"LP",18:"RA",20:"RC",22:"RB",24:"RP",26:"EQ",28:"DOTS",30:"DOT",32:"COMMA",34:"SC",36:"COL",38:"DOLLAR",40:"QMARK",42:"INCREMENTAL",47:"EOF",50:"AT",60:"CARET",63:"PIPE"},
123
- productions_: [0,[3,1],[5,1],[7,1],[9,1],[11,1],[13,1],[15,1],[17,1],[19,1],[21,1],[23,1],[25,1],[27,1],[29,1],[31,1],[33,1],[35,1],[37,1],[39,1],[41,1],[43,4],[44,0],[44,1],[45,0],[45,5],[45,6],[49,1],[49,2],[49,1],[48,3],[48,3],[48,3],[51,0],[51,1],[52,1],[52,3],[53,2],[53,2],[53,2],[53,3],[53,3],[53,3],[54,2],[54,3],[54,3],[54,3],[54,3],[56,1],[56,3],[56,1],[55,0],[55,1],[57,1],[57,3],[58,1],[58,2],[58,2],[58,2],[58,3],[58,3],[58,3],[46,1],[46,2],[46,2],[59,3],[59,3],[59,3],[59,1],[59,2],[59,3],[59,1],[59,1],[59,2],[59,2],[59,2],[59,2],[59,2],[59,1],[61,0],[61,1],[64,1],[64,3],[65,2],[65,2],[65,2],[65,3],[65,3],[65,3],[62,0],[62,1],[66,1],[66,3]],
123
+ productions_: [0,[3,1],[5,1],[7,1],[9,1],[11,1],[13,1],[15,1],[17,1],[19,1],[21,1],[23,1],[25,1],[27,1],[29,1],[31,1],[33,1],[35,1],[37,1],[39,1],[41,1],[43,4],[44,0],[44,1],[45,0],[45,5],[45,6],[49,1],[49,2],[49,1],[48,3],[48,3],[48,3],[51,0],[51,1],[52,1],[52,3],[53,2],[53,2],[53,2],[53,3],[53,3],[53,3],[54,2],[54,3],[54,3],[54,3],[54,3],[56,1],[56,3],[56,1],[55,0],[55,1],[57,1],[57,3],[58,1],[58,2],[58,2],[58,2],[58,3],[58,3],[58,3],[46,1],[46,2],[46,2],[59,3],[59,3],[59,3],[59,1],[59,2],[59,2],[59,3],[59,1],[59,1],[59,2],[59,2],[59,2],[59,2],[59,2],[59,1],[61,0],[61,1],[64,1],[64,3],[65,2],[65,2],[65,2],[65,3],[65,3],[65,3],[62,0],[62,1],[66,1],[66,3]],
124
124
  performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
125
125
  /* this == yyval */
126
126
 
@@ -161,7 +161,7 @@ break;
161
161
  case 28:
162
162
  this.$ = { code: "ref", ref: "@" + $$[$0].value, start: $$[$0-1].start, end: $$[$0].end};
163
163
  break;
164
- case 29: case 48: case 62: case 90:
164
+ case 29: case 48: case 62: case 91:
165
165
  this.$ = $$[$0];
166
166
  break;
167
167
  case 30:
@@ -187,10 +187,10 @@ case 34:
187
187
  return r }
188
188
  , {});
189
189
  break;
190
- case 35: case 53: case 91:
190
+ case 35: case 53: case 92:
191
191
  this.$ = [$$[$0]];
192
192
  break;
193
- case 36: case 54: case 92:
193
+ case 36: case 54: case 93:
194
194
  this.$ = [].concat($$[$0-2],$$[$0]);
195
195
  break;
196
196
  case 37: case 38: case 39:
@@ -269,33 +269,36 @@ case 68:
269
269
  this.$ = {op: "ref", ref: $$[$0].value, start: $$[$0].start, end: $$[$0].end};
270
270
  break;
271
271
  case 69:
272
- this.$ = {...identity, start: $$[$0-1].start, end: $$[$0].end};
272
+ this.$ = {op: "ref", ref: "@" + $$[$0].value, start: $$[$0-1].start, end: $$[$0].end};
273
273
  break;
274
274
  case 70:
275
- this.$ = {...$$[$0-1], start: $$[$0-2].start, end: $$[$0].end };
275
+ this.$ = {...identity, start: $$[$0-1].start, end: $$[$0].end};
276
276
  break;
277
277
  case 71:
278
- this.$ = {op: "str", str: $$[$0].value, start: $$[$0].start, end: $$[$0].end };
278
+ this.$ = {...$$[$0-1], start: $$[$0-2].start, end: $$[$0].end };
279
279
  break;
280
280
  case 72:
281
+ this.$ = {op: "str", str: $$[$0].value, start: $$[$0].start, end: $$[$0].end };
282
+ break;
283
+ case 73:
281
284
  this.$ = {op: "int", int: $$[$0].value, start: $$[$0].start, end: $$[$0].end };
282
285
  break;
283
- case 73: case 74: case 75:
286
+ case 74: case 75: case 76:
284
287
  this.$ = {op: "dot", dot: $$[$0].value, start: $$[$0-1].start, end: $$[$0].end };
285
288
  break;
286
- case 76:
289
+ case 77:
287
290
  this.$ = {op: "code", code: s.as_ref($$[$0]), start: $$[$0-1].start, end: $$[$0].end};
288
291
  break;
289
- case 77:
292
+ case 78:
290
293
  this.$ = {op: "filter", filter: $$[$0], start: $$[$0-1].start, end:$$[$0].end};
291
294
  break;
292
- case 78:
295
+ case 79:
293
296
  this.$ = {op: "pipe", start: $$[$0].start, end: $$[$0].end};
294
297
  break;
295
- case 79:
298
+ case 80:
296
299
  this.$ = {op: "product", product: []};
297
300
  break;
298
- case 80:
301
+ case 81:
299
302
  $$[$0].product.reduce( (labels, {label}) =>
300
303
  { if (labels[label])
301
304
  anError(this._$,`Duplicate label '${label}'.`)
@@ -303,25 +306,25 @@ case 80:
303
306
  return labels; }, {});
304
307
  this.$ = $$[$0];
305
308
  break;
306
- case 81:
309
+ case 82:
307
310
  this.$ = {op: "product", product: [$$[$0]]};
308
311
  break;
309
- case 82:
312
+ case 83:
310
313
  $$[$0-2].product = [].concat($$[$0-2].product,$$[$0]); this.$ = $$[$0-2];
311
314
  break;
312
- case 83: case 84: case 85:
315
+ case 84: case 85: case 86:
313
316
  this.$ = {label: $$[$0].value, exp: $$[$0-1]};
314
317
  break;
315
- case 86: case 87: case 88:
318
+ case 87: case 88: case 89:
316
319
  this.$ = {label: $$[$0-2].value, exp: $$[$0]};
317
320
  break;
318
- case 89:
321
+ case 90:
319
322
  this.$ = [];
320
323
  break;
321
324
  }
322
325
  },
323
- table: [o($V0,[2,22],{43:1,44:2,41:3,42:[1,4]}),{1:[3]},o($V0,[2,24],{45:5}),o($V0,[2,23]),o($V0,[2,20]),{3:7,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:8,38:$V9,39:19,40:$Va,46:6,59:9,63:$Vb},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,47:[1,29],59:30,60:$Vc,63:$Vb},o($Vd,$Ve,{25:34,26:$Vf}),{3:36,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:37,50:$Vg},o($Vh,[2,62]),o([4,6,8,10,12,14,16,18,20,22,24,26,30,32,34,36,38,40,47,60,63],[2,1]),o([4,10,12,14,50],[2,18]),{3:47,4:$V1,5:48,6:$V2,7:49,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,20:[2,79],29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:46,59:9,61:43,63:$Vb,64:44,65:45},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,22:$Vi,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:52,59:9,62:50,63:$Vb,66:51},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,18:$Vi,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:52,59:9,62:53,63:$Vb,66:51},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,23:54,24:$Vj,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:55,59:9,63:$Vb},o($Vh,$Vk),o($Vh,$Vl),{3:59,4:$V1,5:58,6:$V2,7:57,8:$V3},{3:62,4:$V1,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,37:63,38:$V9,54:61,56:60},o($Vh,[2,78]),o([4,6,8,10,12,14,16,20,28,30,38,40,50,63],[2,5]),o([4,6,8,10,12,14,16,22,30,38,40,50,63],[2,6]),o([4,6,8,10,12,14,16,18,28,30,38,40,50,63],[2,4]),o([4,6,8,10,12,14,16,24,28,30,38,40,63],[2,7]),o($Vm,[2,2]),o($Vm,[2,3]),o($Vn,[2,14]),o([4,10,12,14,16,38],[2,19]),{1:[2,21]},o($Vh,[2,63]),o($Vh,[2,64]),o($Vh,$Ve),{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:37,50:$Vg},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:69,59:9,63:$Vb},o($V0,[2,12]),o($Vd,$Vo,{25:70,26:$Vf}),o($Vh,[2,76]),{3:71,4:$V1},o($Vp,[2,29]),{3:76,4:$V1,5:77,6:$V2,7:78,8:$V3,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,20:$Vq,48:39,49:75,50:$Vg,51:72,52:73,53:74},{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:79,50:$Vg},{3:76,4:$V1,5:77,6:$V2,7:78,8:$V3,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,18:$Vq,48:39,49:75,50:$Vg,51:80,52:73,53:74},{19:81,20:$Vr},{20:[2,80],31:83,32:$Vs},o($Vt,[2,81]),{3:85,4:$V1,5:86,6:$V2,7:87,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,59:30,60:$Vc,63:$Vb},o($Vu,$Ve,{35:88,36:$Vv}),o($Vu,$Vk,{35:90,36:$Vv}),o($Vu,$Vl,{35:91,36:$Vv}),{21:92,22:$Vw},o([18,22],[2,90],{31:94,32:$Vs}),o($Vx,[2,91],{11:12,13:13,9:14,15:15,5:16,7:17,29:18,39:19,59:30,3:32,37:33,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,60:$Vc,63:$Vb}),{17:95,18:$Vy},o($Vh,[2,69]),{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,23:97,24:$Vj,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,59:30,60:$Vc,63:$Vb},o($Vp,[2,11]),o($Vh,[2,73]),o($Vh,[2,74]),o($Vh,[2,75]),o($Vh,[2,77]),o($Vh,[2,48],{26:[1,98]}),o($Vh,$Vz),{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:99,50:$Vg},{3:105,4:$V1,5:106,6:$V2,7:107,8:$V3,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,24:$VA,27:103,28:$VB,37:63,38:$V9,54:61,55:100,56:104,57:101,58:102},{3:105,4:$V1,5:106,6:$V2,7:107,8:$V3,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,18:$VA,27:103,28:$VB,37:63,38:$V9,54:61,55:109,56:104,57:101,58:102},{3:105,4:$V1,5:106,6:$V2,7:107,8:$V3,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,20:$VA,27:103,28:$VB,37:63,38:$V9,54:61,55:110,56:104,57:101,58:102},{3:62,4:$V1,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,37:63,38:$V9,54:61,56:111},o($Vp,$Vo),{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,33:112,34:[1,113],37:33,38:$V9,39:19,40:$Va,59:30,60:$Vc,63:$Vb},{9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:114},o($Vp,[2,28]),{19:115,20:$Vr},o([18,20],[2,34],{31:116,32:$Vs}),o($VC,[2,35]),{3:117,4:$V1,5:118,6:$V2,7:119,8:$V3},o($Vn,$Vo,{35:120,36:$Vv}),{35:121,36:$Vv},{35:122,36:$Vv},{21:123,22:$Vw},{17:124,18:$Vy},o($Vh,[2,65]),o($Vp,[2,9]),{3:47,4:$V1,5:48,6:$V2,7:49,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:46,59:9,63:$Vb,65:125},o([4,6,8,10,12,14,16,28,30,38,40,50,63],[2,15]),o($Vu,$Ve,{20:$VD,32:$VD}),o($Vu,$Vk,{20:$VE,32:$VE}),o($Vu,$Vl,{20:$VF,32:$VF}),{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:126,59:9,63:$Vb},o([4,6,8,10,12,14,16,30,38,40,50,63],[2,17]),{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:127,59:9,63:$Vb},{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:128,59:9,63:$Vb},o($Vh,[2,66]),o($Vp,[2,10]),{3:32,4:$V1,5:16,6:$V2,7:17,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:15,16:$V7,29:18,30:$V8,37:33,38:$V9,39:19,40:$Va,46:129,59:9,63:$Vb},o($Vh,[2,67]),o($Vp,[2,8]),o($Vh,[2,70]),{3:130,4:$V1},o($Vp,[2,43]),{23:131,24:$Vj},o([18,20,24],[2,52],{31:132,32:$Vs}),o($VG,[2,53]),o($VG,[2,55]),{3:133,4:$V1,5:134,6:$V2,7:135,8:$V3},o($Vn,$Vz,{35:136,36:$Vv}),{35:137,36:$Vv},{35:138,36:$Vv},o($VG,[2,13]),{17:139,18:$Vy},{19:140,20:$Vr},{21:141,22:$Vw},o($V0,[2,25]),o($V0,[2,16]),{34:[1,142]},o($Vp,[2,30]),{3:76,4:$V1,5:77,6:$V2,7:78,8:$V3,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:75,50:$Vg,53:143},o($VC,[2,37]),o($VC,[2,38]),o($VC,[2,39]),{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:144,50:$Vg},{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:145,50:$Vg},{3:68,4:$V1,9:42,10:$V4,11:40,12:$V5,13:41,14:$V6,48:39,49:146,50:$Vg},o($Vp,[2,31]),o($Vp,[2,32]),o($Vt,[2,82]),o($Vt,[2,86],{11:12,13:13,9:14,15:15,5:16,7:17,29:18,39:19,59:30,3:32,37:33,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,60:$Vc,63:$Vb}),o($Vt,[2,87],{11:12,13:13,9:14,15:15,5:16,7:17,29:18,39:19,59:30,3:32,37:33,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,60:$Vc,63:$Vb}),o($Vt,[2,88],{11:12,13:13,9:14,15:15,5:16,7:17,29:18,39:19,59:30,3:32,37:33,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,60:$Vc,63:$Vb}),o($Vx,[2,92],{11:12,13:13,9:14,15:15,5:16,7:17,29:18,39:19,59:30,3:32,37:33,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,60:$Vc,63:$Vb}),o($Vh,[2,49]),o($Vp,[2,44]),{3:105,4:$V1,5:106,6:$V2,7:107,8:$V3,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,27:103,28:$VB,37:63,38:$V9,54:61,56:104,58:147},o($VG,[2,56]),o($VG,[2,57]),o($VG,[2,58]),{3:62,4:$V1,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,37:63,38:$V9,54:61,56:148},{3:62,4:$V1,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,37:63,38:$V9,54:61,56:149},{3:62,4:$V1,9:65,10:$V4,11:66,12:$V5,13:67,14:$V6,15:64,16:$V7,37:63,38:$V9,54:61,56:150},o($Vp,[2,45]),o($Vp,[2,46]),o($Vp,[2,47]),o($V0,[2,26]),o($VC,[2,36]),o($VC,[2,40]),o($VC,[2,41]),o($VC,[2,42]),o($VG,[2,54]),o($VG,[2,59]),o($VG,[2,60]),o($VG,[2,61])],
324
- defaultActions: {29:[2,21]},
326
+ table: [o($V0,[2,22],{43:1,44:2,41:3,42:[1,4]}),{1:[3]},o($V0,[2,24],{45:5}),o($V0,[2,23]),o($V0,[2,20]),{3:7,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:8,38:$V9,39:20,40:$Va,46:6,50:$Vb,59:9,63:$Vc},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,47:[1,30],50:$Vb,59:31,60:$Vd,63:$Vc},o($Ve,$Vf,{25:35,26:$Vg}),{3:37,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:38,50:$Vh},o($Vi,[2,62]),o([4,6,8,10,12,14,16,18,20,22,24,26,30,32,34,36,38,40,47,50,60,63],[2,1]),o([4,10,12,14,50],[2,18]),{3:48,4:$V1,5:49,6:$V2,7:50,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,20:[2,80],29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:47,50:$Vb,59:9,61:44,63:$Vc,64:45,65:46},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,22:$Vj,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:53,50:$Vb,59:9,62:51,63:$Vc,66:52},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,18:$Vj,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:53,50:$Vb,59:9,62:54,63:$Vc,66:52},{3:55,4:$V1},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,23:56,24:$Vk,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:57,50:$Vb,59:9,63:$Vc},o($Vi,$Vl),o($Vi,$Vm),{3:61,4:$V1,5:60,6:$V2,7:59,8:$V3},{3:64,4:$V1,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,37:65,38:$V9,54:63,56:62},o($Vi,[2,79]),o([4,6,8,10,12,14,16,20,28,30,38,40,50,63],[2,5]),o([4,6,8,10,12,14,16,22,30,38,40,50,63],[2,6]),o([4,6,8,10,12,14,16,18,28,30,38,40,50,63],[2,4]),o([4,6,8,10,12,14,16,24,28,30,38,40,50,63],[2,7]),o($Vn,[2,2]),o($Vn,[2,3]),o($Vo,[2,14]),o([4,10,12,14,16,38],[2,19]),{1:[2,21]},o($Vi,[2,63]),o($Vi,[2,64]),o($Vi,$Vf),{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:38,50:$Vh},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:71,50:$Vb,59:9,63:$Vc},o($V0,[2,12]),o($Ve,$Vp,{25:72,26:$Vg}),o($Vi,[2,77]),{3:73,4:$V1},o($Vq,[2,29]),{3:78,4:$V1,5:79,6:$V2,7:80,8:$V3,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,20:$Vr,48:40,49:77,50:$Vh,51:74,52:75,53:76},{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:81,50:$Vh},{3:78,4:$V1,5:79,6:$V2,7:80,8:$V3,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,18:$Vr,48:40,49:77,50:$Vh,51:82,52:75,53:76},{19:83,20:$Vs},{20:[2,81],31:85,32:$Vt},o($Vu,[2,82]),{3:87,4:$V1,5:88,6:$V2,7:89,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,50:$Vb,59:31,60:$Vd,63:$Vc},o($Vv,$Vf,{35:90,36:$Vw}),o($Vv,$Vl,{35:92,36:$Vw}),o($Vv,$Vm,{35:93,36:$Vw}),{21:94,22:$Vx},o([18,22],[2,91],{31:96,32:$Vt}),o($Vy,[2,92],{11:12,13:13,9:14,15:16,5:17,7:18,29:19,39:20,59:31,3:33,37:34,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,50:$Vb,60:$Vd,63:$Vc}),{17:97,18:$Vz},o($Vi,[2,69]),o($Vi,[2,70]),{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,23:99,24:$Vk,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,50:$Vb,59:31,60:$Vd,63:$Vc},o($Vq,[2,11]),o($Vi,[2,74]),o($Vi,[2,75]),o($Vi,[2,76]),o($Vi,[2,78]),o($Vi,[2,48],{26:[1,100]}),o($Vi,$VA),{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:101,50:$Vh},{3:107,4:$V1,5:108,6:$V2,7:109,8:$V3,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,24:$VB,27:105,28:$VC,37:65,38:$V9,54:63,55:102,56:106,57:103,58:104},{3:107,4:$V1,5:108,6:$V2,7:109,8:$V3,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,18:$VB,27:105,28:$VC,37:65,38:$V9,54:63,55:111,56:106,57:103,58:104},{3:107,4:$V1,5:108,6:$V2,7:109,8:$V3,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,20:$VB,27:105,28:$VC,37:65,38:$V9,54:63,55:112,56:106,57:103,58:104},{3:64,4:$V1,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,37:65,38:$V9,54:63,56:113},o($Vq,$Vp),{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,33:114,34:[1,115],37:34,38:$V9,39:20,40:$Va,50:$Vb,59:31,60:$Vd,63:$Vc},{9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:116},o($Vq,[2,28]),{19:117,20:$Vs},o([18,20],[2,34],{31:118,32:$Vt}),o($VD,[2,35]),{3:119,4:$V1,5:120,6:$V2,7:121,8:$V3},o($Vo,$Vp,{35:122,36:$Vw}),{35:123,36:$Vw},{35:124,36:$Vw},{21:125,22:$Vx},{17:126,18:$Vz},o($Vi,[2,65]),o($Vq,[2,9]),{3:48,4:$V1,5:49,6:$V2,7:50,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:47,50:$Vb,59:9,63:$Vc,65:127},o([4,6,8,10,12,14,16,28,30,38,40,50,63],[2,15]),o($Vv,$Vf,{20:$VE,32:$VE}),o($Vv,$Vl,{20:$VF,32:$VF}),o($Vv,$Vm,{20:$VG,32:$VG}),{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:128,50:$Vb,59:9,63:$Vc},o($V0,[2,17]),{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:129,50:$Vb,59:9,63:$Vc},{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:130,50:$Vb,59:9,63:$Vc},o($Vi,[2,66]),o($Vq,[2,10]),{3:33,4:$V1,5:17,6:$V2,7:18,8:$V3,9:14,10:$V4,11:12,12:$V5,13:13,14:$V6,15:16,16:$V7,29:19,30:$V8,37:34,38:$V9,39:20,40:$Va,46:131,50:$Vb,59:9,63:$Vc},o($Vi,[2,67]),o($Vq,[2,8]),o($Vi,[2,71]),{3:132,4:$V1},o($Vq,[2,43]),{23:133,24:$Vk},o([18,20,24],[2,52],{31:134,32:$Vt}),o($VH,[2,53]),o($VH,[2,55]),{3:135,4:$V1,5:136,6:$V2,7:137,8:$V3},o($Vo,$VA,{35:138,36:$Vw}),{35:139,36:$Vw},{35:140,36:$Vw},o($VH,[2,13]),{17:141,18:$Vz},{19:142,20:$Vs},{21:143,22:$Vx},o($V0,[2,25]),o($V0,[2,16]),{34:[1,144]},o($Vq,[2,30]),{3:78,4:$V1,5:79,6:$V2,7:80,8:$V3,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:77,50:$Vh,53:145},o($VD,[2,37]),o($VD,[2,38]),o($VD,[2,39]),{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:146,50:$Vh},{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:147,50:$Vh},{3:70,4:$V1,9:43,10:$V4,11:41,12:$V5,13:42,14:$V6,48:40,49:148,50:$Vh},o($Vq,[2,31]),o($Vq,[2,32]),o($Vu,[2,83]),o($Vu,[2,87],{11:12,13:13,9:14,15:16,5:17,7:18,29:19,39:20,59:31,3:33,37:34,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,50:$Vb,60:$Vd,63:$Vc}),o($Vu,[2,88],{11:12,13:13,9:14,15:16,5:17,7:18,29:19,39:20,59:31,3:33,37:34,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,50:$Vb,60:$Vd,63:$Vc}),o($Vu,[2,89],{11:12,13:13,9:14,15:16,5:17,7:18,29:19,39:20,59:31,3:33,37:34,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,50:$Vb,60:$Vd,63:$Vc}),o($Vy,[2,93],{11:12,13:13,9:14,15:16,5:17,7:18,29:19,39:20,59:31,3:33,37:34,4:$V1,6:$V2,8:$V3,10:$V4,12:$V5,14:$V6,16:$V7,30:$V8,38:$V9,40:$Va,50:$Vb,60:$Vd,63:$Vc}),o($Vi,[2,49]),o($Vq,[2,44]),{3:107,4:$V1,5:108,6:$V2,7:109,8:$V3,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,27:105,28:$VC,37:65,38:$V9,54:63,56:106,58:149},o($VH,[2,56]),o($VH,[2,57]),o($VH,[2,58]),{3:64,4:$V1,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,37:65,38:$V9,54:63,56:150},{3:64,4:$V1,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,37:65,38:$V9,54:63,56:151},{3:64,4:$V1,9:67,10:$V4,11:68,12:$V5,13:69,14:$V6,15:66,16:$V7,37:65,38:$V9,54:63,56:152},o($Vq,[2,45]),o($Vq,[2,46]),o($Vq,[2,47]),o($V0,[2,26]),o($VD,[2,36]),o($VD,[2,40]),o($VD,[2,41]),o($VD,[2,42]),o($VH,[2,54]),o($VH,[2,59]),o($VH,[2,60]),o($VH,[2,61])],
327
+ defaultActions: {30:[2,21]},
325
328
  parseError: function parseError (str, hash) {
326
329
  if (hash.recoverable) {
327
330
  this.trace(str);
package/patterns.mjs CHANGED
@@ -174,12 +174,12 @@ function patterns(representatives, rels) {
174
174
  case "int":
175
175
  rel.patterns = [];
176
176
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
177
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('int');
177
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@int');
178
178
  break;
179
179
  case "str":
180
180
  rel.patterns = [];
181
181
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
182
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('string');
182
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@string');
183
183
  break;
184
184
  case "identity":
185
185
  rel.patterns = [];
@@ -286,7 +286,7 @@ function patterns(representatives, rels) {
286
286
  rel.patterns = [];
287
287
  if (rel.union.length == 0) {
288
288
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
289
- rel.patterns[1] = rootDef.typePatternGraph.addNewNode({pattern: '<>'});
289
+ rel.patterns[1] = rootDef.typePatternGraph.addNewNode();
290
290
  } else {
291
291
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
292
292
  rootDef.typePatternGraph.unify(
@@ -359,39 +359,39 @@ function patterns(representatives, rels) {
359
359
  case "true":
360
360
  case "false":
361
361
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
362
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('bool');
362
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@bool');
363
363
  break;
364
364
  case "PLUS":
365
365
  case "TIMES":
366
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('int');
366
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@int');
367
367
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode({pattern: '[]'}, {"vector-member": [rel.patterns[1]]});
368
368
  break;
369
369
  case "CONCAT":
370
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('string');
370
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@string');
371
371
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode({pattern: '[]'}, {"vector-member": [rel.patterns[1]]});
372
372
  break;
373
373
  case "toVEC":
374
- rel.patterns[0] = rootDef.typePatternGraph.getTypeId('string')
374
+ rel.patterns[0] = rootDef.typePatternGraph.getTypeId('@string')
375
375
  rel.patterns[1] = rootDef.typePatternGraph.addNewNode({pattern: '[]'}, {"vector-member": [rel.patterns[0]]});
376
376
  break;
377
377
  case "toDateMsec":
378
378
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
379
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('int');
379
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@int');
380
380
  break;
381
381
  case "toJSON":
382
382
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
383
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('string');
383
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@string');
384
384
  break;
385
385
  case "toDateStr":
386
386
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode();
387
- rel.patterns[1] = rootDef.typePatternGraph.getTypeId('string');
387
+ rel.patterns[1] = rootDef.typePatternGraph.getTypeId('@string');
388
388
  break;
389
389
  case "GT":
390
390
  case "EQ":
391
391
  rel.patterns[0] = rel.patterns[1] = rootDef.typePatternGraph.addNewNode({pattern: '[]'}, {"vector-member": [rootDef.typePatternGraph.addNewNode()]});
392
392
  break;
393
393
  case "fromJSON":
394
- rel.patterns[0] = rootDef.typePatternGraph.getTypeId('string');
394
+ rel.patterns[0] = rootDef.typePatternGraph.getTypeId('@string');
395
395
  rel.patterns[1] = rootDef.typePatternGraph.addNewNode();
396
396
  break;
397
397
  case "CONS": {
@@ -405,7 +405,7 @@ function patterns(representatives, rels) {
405
405
  rel.patterns[1] = rootDef.typePatternGraph.addNewNode({pattern: '{}'}, {"car": [member], "cdr": [rel.patterns[0]]});
406
406
  }; break;
407
407
  case "DIV": {
408
- const intId = rootDef.typePatternGraph.getTypeId('int');
408
+ const intId = rootDef.typePatternGraph.getTypeId('@int');
409
409
  rel.patterns[0] = rootDef.typePatternGraph.addNewNode({pattern: '[]'}, {"vector-member": [intId]});
410
410
  rel.patterns[1] = rootDef.typePatternGraph.addNewNode({pattern: '{}'}, {"div": [intId], "rem": [intId]});
411
411
  }; break;
package/run.mjs CHANGED
@@ -68,9 +68,9 @@ const builtin = {
68
68
  };
69
69
 
70
70
  const codes = {
71
- int: (x) => Number.isInteger(x),
72
- string: (x) => x instanceof String || "string" === typeof x,
73
- bool: (x) => x === true || x === false,
71
+ "@int": (x) => Number.isInteger(x),
72
+ "@string": (x) => x instanceof String || "string" === typeof x,
73
+ "@bool": (x) => x === true || x === false,
74
74
  };
75
75
 
76
76
  function verify(code, value) {
@@ -5,8 +5,8 @@ import hash from './hash.mjs';
5
5
  `
6
6
  $nat = < {} zero, nat succ>;
7
7
  $pair = {nat x, nat y};
8
- $b = {int"x", bool y};
9
- $vector = [int];
8
+ $b = {@int"x", @bool y};
9
+ $vector = [@int];
10
10
  $tree = <{nat value, tree left, tree right} binary, nat leaf, {nat value, tree tree} unary, [tree] list_of_trees>;
11
11
 
12
12
  succ = { $nat succ} $nat;
package/test.mjs CHANGED
@@ -62,7 +62,7 @@ console.log("");
62
62
  });
63
63
 
64
64
 
65
- k_expression = "$ < < [ int ] ints, [ bool ] bools > list, string None>";
65
+ k_expression = "$ < < [ @int ] ints, [ @bool ] bools > list, @string None>";
66
66
 
67
67
  k_fn = k.compile(k_expression);
68
68
 
package/tests.sh ADDED
@@ -0,0 +1,6 @@
1
+
2
+ # This script is used to run the k.mjs interpreter with various test cases.
3
+
4
+ echo "Running './tests.sh' ..."
5
+
6
+ echo '[4,2,19,1]' | ./k.mjs -k Examples/rec-code.k -1
package/typing.mjs CHANGED
@@ -401,14 +401,14 @@ class TypePatternGraph {
401
401
  case 'type': {
402
402
  const code = codes.find(p2.type);
403
403
  switch (code.code) {
404
- case 'int':
404
+ case '@int':
405
405
  // supports (2 .2) which returns unit
406
406
  if (p1.fields.every(x => `${x}`.match(/^[0-9]+$/)))
407
407
  return p2;
408
408
  break;
409
- case 'string':
409
+ case '@string':
410
410
  return p2;
411
- case 'bool':
411
+ case '@bool':
412
412
  if (p1.fields.every(x => `${x}`.match(/^true|false$/)))
413
413
  return p2;
414
414
  break;
@@ -471,14 +471,14 @@ class TypePatternGraph {
471
471
  case 'type':{
472
472
  const code = codes.find(p2.type);
473
473
  switch (code.code) {
474
- case 'int':
474
+ case '@int':
475
475
  // supports (2 .2) which returns unit
476
476
  if (p1.fields.every(x => `${x}`.match(/^[0-9]+$/)))
477
477
  return p2;
478
478
  break;
479
- case 'string':
479
+ case '@string':
480
480
  return p2;
481
- case 'bool':
481
+ case '@bool':
482
482
  if (p1.fields.every(x => `${x}`.match(/^true|false$/)))
483
483
  return p2;
484
484
  break;
@@ -508,13 +508,13 @@ class TypePatternGraph {
508
508
  case 'type':{
509
509
  const code = codes.find(p2.type);
510
510
  switch (code.code) {
511
- case 'int':
511
+ case '@int':
512
512
  if (p1.fields.every(x => `${x}`.match(/^[0-9]+$/)))
513
513
  return p2;
514
514
  break;
515
- case 'string':
515
+ case '@string':
516
516
  return p2;
517
- case 'bool':
517
+ case '@bool':
518
518
  if (p1.fields.every(x => `${x}`.match(/^true|false$/)))
519
519
  return p2;
520
520
  break;
@@ -645,9 +645,9 @@ class TypePatternGraph {
645
645
  if (new_pattern.pattern == 'type') {
646
646
  const code = codes.find(new_pattern.type);
647
647
  switch (code.code) {
648
- case 'int':
649
- case 'string':
650
- case 'bool': {
648
+ case '@int':
649
+ case '@string':
650
+ case '@bool': {
651
651
  // all edges are goin to unit type
652
652
  const unit_id = this.getTypeId(unitCode);
653
653
  for (const lab in this.edges[new_id]) {
@@ -667,7 +667,7 @@ class TypePatternGraph {
667
667
  const target_type_id = this.getTypeId(code.vector);
668
668
 
669
669
  this.edges[new_id] = {
670
- 'vector-member': asSet([ target_type_id, ...Object.values(this.edges[new_id])])
670
+ 'vector-member': asSet([ target_type_id, ...[].concat(...Object.values(this.edges[new_id]))])
671
671
  }
672
672
  }
673
673
  }