@scinorandex/sparse 0.0.7 → 0.0.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 +1 -2
- package/dist/meta/common.d.ts +12 -10
- package/dist/meta/common.js +12 -10
- package/dist/meta/common.js.map +1 -1
- package/dist/meta/selfhosted.js +66 -15
- package/dist/meta/selfhosted.js.map +1 -1
- package/dist/meta/states.d.ts +108 -0
- package/dist/meta/states.js +213 -47
- package/dist/meta/states.js.map +1 -1
- package/example/kleene-test/example.ts +86 -0
- package/example/kleene-test/grammar.txt +2 -0
- package/example/selfhosted/01-meta-grammar.txt +1 -1
- package/example/selfhosted/codegen-meta.ts +213 -47
- package/package.json +1 -1
- package/src/meta/common.ts +2 -0
- package/src/meta/selfhosted.ts +97 -33
- package/src/meta/states.ts +213 -47
package/src/meta/states.ts
CHANGED
|
@@ -380,11 +380,11 @@ export const states = [
|
|
|
380
380
|
{
|
|
381
381
|
"[R_ANGLE]": {
|
|
382
382
|
"type": "reduce",
|
|
383
|
-
"value":
|
|
383
|
+
"value": 18
|
|
384
384
|
},
|
|
385
385
|
"[COLON]": {
|
|
386
386
|
"type": "reduce",
|
|
387
|
-
"value":
|
|
387
|
+
"value": 18
|
|
388
388
|
},
|
|
389
389
|
"[PIPE]": {
|
|
390
390
|
"type": "shift",
|
|
@@ -404,11 +404,11 @@ export const states = [
|
|
|
404
404
|
{
|
|
405
405
|
"[R_BRACKET]": {
|
|
406
406
|
"type": "reduce",
|
|
407
|
-
"value":
|
|
407
|
+
"value": 18
|
|
408
408
|
},
|
|
409
409
|
"[COLON]": {
|
|
410
410
|
"type": "reduce",
|
|
411
|
-
"value":
|
|
411
|
+
"value": 18
|
|
412
412
|
},
|
|
413
413
|
"[PIPE]": {
|
|
414
414
|
"type": "shift",
|
|
@@ -459,6 +459,14 @@ export const states = [
|
|
|
459
459
|
"[QUESTION_MARK]": {
|
|
460
460
|
"type": "shift",
|
|
461
461
|
"value": 41
|
|
462
|
+
},
|
|
463
|
+
"[PLUS]": {
|
|
464
|
+
"type": "shift",
|
|
465
|
+
"value": 42
|
|
466
|
+
},
|
|
467
|
+
"[STAR]": {
|
|
468
|
+
"type": "shift",
|
|
469
|
+
"value": 43
|
|
462
470
|
}
|
|
463
471
|
},
|
|
464
472
|
{
|
|
@@ -470,83 +478,83 @@ export const states = [
|
|
|
470
478
|
{
|
|
471
479
|
"[SEMICOLON]": {
|
|
472
480
|
"type": "reduce",
|
|
473
|
-
"value":
|
|
481
|
+
"value": 14
|
|
474
482
|
},
|
|
475
483
|
"[R_PAREN]": {
|
|
476
484
|
"type": "reduce",
|
|
477
|
-
"value":
|
|
485
|
+
"value": 14
|
|
478
486
|
},
|
|
479
487
|
"[L_PAREN]": {
|
|
480
488
|
"type": "reduce",
|
|
481
|
-
"value":
|
|
489
|
+
"value": 14
|
|
482
490
|
},
|
|
483
491
|
"[L_ANGLE]": {
|
|
484
492
|
"type": "reduce",
|
|
485
|
-
"value":
|
|
493
|
+
"value": 14
|
|
486
494
|
},
|
|
487
495
|
"[L_BRACKET]": {
|
|
488
496
|
"type": "reduce",
|
|
489
|
-
"value":
|
|
497
|
+
"value": 14
|
|
490
498
|
}
|
|
491
499
|
},
|
|
492
500
|
{
|
|
493
501
|
"[IDENTIFIER]": {
|
|
494
502
|
"type": "shift",
|
|
495
|
-
"value":
|
|
503
|
+
"value": 44
|
|
496
504
|
}
|
|
497
505
|
},
|
|
498
506
|
{
|
|
499
507
|
"[IDENTIFIER]": {
|
|
500
508
|
"type": "shift",
|
|
501
|
-
"value":
|
|
509
|
+
"value": 46
|
|
502
510
|
},
|
|
503
511
|
"<INSIDE>": {
|
|
504
512
|
"type": "goto",
|
|
505
|
-
"value":
|
|
513
|
+
"value": 45
|
|
506
514
|
}
|
|
507
515
|
},
|
|
508
516
|
{
|
|
509
517
|
"[SEMICOLON]": {
|
|
510
518
|
"type": "reduce",
|
|
511
|
-
"value":
|
|
519
|
+
"value": 16
|
|
512
520
|
},
|
|
513
521
|
"[R_PAREN]": {
|
|
514
522
|
"type": "reduce",
|
|
515
|
-
"value":
|
|
523
|
+
"value": 16
|
|
516
524
|
},
|
|
517
525
|
"[L_PAREN]": {
|
|
518
526
|
"type": "reduce",
|
|
519
|
-
"value":
|
|
527
|
+
"value": 16
|
|
520
528
|
},
|
|
521
529
|
"[L_ANGLE]": {
|
|
522
530
|
"type": "reduce",
|
|
523
|
-
"value":
|
|
531
|
+
"value": 16
|
|
524
532
|
},
|
|
525
533
|
"[L_BRACKET]": {
|
|
526
534
|
"type": "reduce",
|
|
527
|
-
"value":
|
|
535
|
+
"value": 16
|
|
528
536
|
}
|
|
529
537
|
},
|
|
530
538
|
{
|
|
531
539
|
"[IDENTIFIER]": {
|
|
532
540
|
"type": "shift",
|
|
533
|
-
"value":
|
|
541
|
+
"value": 47
|
|
534
542
|
}
|
|
535
543
|
},
|
|
536
544
|
{
|
|
537
545
|
"[IDENTIFIER]": {
|
|
538
546
|
"type": "shift",
|
|
539
|
-
"value":
|
|
547
|
+
"value": 46
|
|
540
548
|
},
|
|
541
549
|
"<INSIDE>": {
|
|
542
550
|
"type": "goto",
|
|
543
|
-
"value":
|
|
551
|
+
"value": 48
|
|
544
552
|
}
|
|
545
553
|
},
|
|
546
554
|
{
|
|
547
555
|
"[SEMICOLON]": {
|
|
548
556
|
"type": "shift",
|
|
549
|
-
"value":
|
|
557
|
+
"value": 49
|
|
550
558
|
}
|
|
551
559
|
},
|
|
552
560
|
{
|
|
@@ -571,54 +579,98 @@ export const states = [
|
|
|
571
579
|
"value": 11
|
|
572
580
|
}
|
|
573
581
|
},
|
|
582
|
+
{
|
|
583
|
+
"[SEMICOLON]": {
|
|
584
|
+
"type": "reduce",
|
|
585
|
+
"value": 12
|
|
586
|
+
},
|
|
587
|
+
"[R_PAREN]": {
|
|
588
|
+
"type": "reduce",
|
|
589
|
+
"value": 12
|
|
590
|
+
},
|
|
591
|
+
"[L_PAREN]": {
|
|
592
|
+
"type": "reduce",
|
|
593
|
+
"value": 12
|
|
594
|
+
},
|
|
595
|
+
"[L_ANGLE]": {
|
|
596
|
+
"type": "reduce",
|
|
597
|
+
"value": 12
|
|
598
|
+
},
|
|
599
|
+
"[L_BRACKET]": {
|
|
600
|
+
"type": "reduce",
|
|
601
|
+
"value": 12
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"[SEMICOLON]": {
|
|
606
|
+
"type": "reduce",
|
|
607
|
+
"value": 13
|
|
608
|
+
},
|
|
609
|
+
"[R_PAREN]": {
|
|
610
|
+
"type": "reduce",
|
|
611
|
+
"value": 13
|
|
612
|
+
},
|
|
613
|
+
"[L_PAREN]": {
|
|
614
|
+
"type": "reduce",
|
|
615
|
+
"value": 13
|
|
616
|
+
},
|
|
617
|
+
"[L_ANGLE]": {
|
|
618
|
+
"type": "reduce",
|
|
619
|
+
"value": 13
|
|
620
|
+
},
|
|
621
|
+
"[L_BRACKET]": {
|
|
622
|
+
"type": "reduce",
|
|
623
|
+
"value": 13
|
|
624
|
+
}
|
|
625
|
+
},
|
|
574
626
|
{
|
|
575
627
|
"[R_ANGLE]": {
|
|
576
628
|
"type": "shift",
|
|
577
|
-
"value":
|
|
629
|
+
"value": 50
|
|
578
630
|
}
|
|
579
631
|
},
|
|
580
632
|
{
|
|
581
633
|
"[R_ANGLE]": {
|
|
582
634
|
"type": "reduce",
|
|
583
|
-
"value":
|
|
635
|
+
"value": 19
|
|
584
636
|
},
|
|
585
637
|
"[COLON]": {
|
|
586
638
|
"type": "reduce",
|
|
587
|
-
"value":
|
|
639
|
+
"value": 19
|
|
588
640
|
}
|
|
589
641
|
},
|
|
590
642
|
{
|
|
591
643
|
"[R_ANGLE]": {
|
|
592
644
|
"type": "reduce",
|
|
593
|
-
"value":
|
|
645
|
+
"value": 18
|
|
594
646
|
},
|
|
595
647
|
"[COLON]": {
|
|
596
648
|
"type": "reduce",
|
|
597
|
-
"value":
|
|
649
|
+
"value": 18
|
|
598
650
|
},
|
|
599
651
|
"[R_BRACKET]": {
|
|
600
652
|
"type": "reduce",
|
|
601
|
-
"value":
|
|
653
|
+
"value": 18
|
|
602
654
|
},
|
|
603
655
|
"[PIPE]": {
|
|
604
656
|
"type": "shift",
|
|
605
|
-
"value":
|
|
657
|
+
"value": 51
|
|
606
658
|
}
|
|
607
659
|
},
|
|
608
660
|
{
|
|
609
661
|
"[R_BRACKET]": {
|
|
610
662
|
"type": "shift",
|
|
611
|
-
"value":
|
|
663
|
+
"value": 52
|
|
612
664
|
}
|
|
613
665
|
},
|
|
614
666
|
{
|
|
615
667
|
"[R_BRACKET]": {
|
|
616
668
|
"type": "reduce",
|
|
617
|
-
"value":
|
|
669
|
+
"value": 19
|
|
618
670
|
},
|
|
619
671
|
"[COLON]": {
|
|
620
672
|
"type": "reduce",
|
|
621
|
-
"value":
|
|
673
|
+
"value": 19
|
|
622
674
|
}
|
|
623
675
|
},
|
|
624
676
|
{
|
|
@@ -634,69 +686,69 @@ export const states = [
|
|
|
634
686
|
{
|
|
635
687
|
"[SEMICOLON]": {
|
|
636
688
|
"type": "reduce",
|
|
637
|
-
"value":
|
|
689
|
+
"value": 15
|
|
638
690
|
},
|
|
639
691
|
"[R_PAREN]": {
|
|
640
692
|
"type": "reduce",
|
|
641
|
-
"value":
|
|
693
|
+
"value": 15
|
|
642
694
|
},
|
|
643
695
|
"[L_PAREN]": {
|
|
644
696
|
"type": "reduce",
|
|
645
|
-
"value":
|
|
697
|
+
"value": 15
|
|
646
698
|
},
|
|
647
699
|
"[L_ANGLE]": {
|
|
648
700
|
"type": "reduce",
|
|
649
|
-
"value":
|
|
701
|
+
"value": 15
|
|
650
702
|
},
|
|
651
703
|
"[L_BRACKET]": {
|
|
652
704
|
"type": "reduce",
|
|
653
|
-
"value":
|
|
705
|
+
"value": 15
|
|
654
706
|
}
|
|
655
707
|
},
|
|
656
708
|
{
|
|
657
709
|
"[IDENTIFIER]": {
|
|
658
710
|
"type": "shift",
|
|
659
|
-
"value":
|
|
711
|
+
"value": 46
|
|
660
712
|
},
|
|
661
713
|
"<INSIDE>": {
|
|
662
714
|
"type": "goto",
|
|
663
|
-
"value":
|
|
715
|
+
"value": 53
|
|
664
716
|
}
|
|
665
717
|
},
|
|
666
718
|
{
|
|
667
719
|
"[SEMICOLON]": {
|
|
668
720
|
"type": "reduce",
|
|
669
|
-
"value":
|
|
721
|
+
"value": 17
|
|
670
722
|
},
|
|
671
723
|
"[R_PAREN]": {
|
|
672
724
|
"type": "reduce",
|
|
673
|
-
"value":
|
|
725
|
+
"value": 17
|
|
674
726
|
},
|
|
675
727
|
"[L_PAREN]": {
|
|
676
728
|
"type": "reduce",
|
|
677
|
-
"value":
|
|
729
|
+
"value": 17
|
|
678
730
|
},
|
|
679
731
|
"[L_ANGLE]": {
|
|
680
732
|
"type": "reduce",
|
|
681
|
-
"value":
|
|
733
|
+
"value": 17
|
|
682
734
|
},
|
|
683
735
|
"[L_BRACKET]": {
|
|
684
736
|
"type": "reduce",
|
|
685
|
-
"value":
|
|
737
|
+
"value": 17
|
|
686
738
|
}
|
|
687
739
|
},
|
|
688
740
|
{
|
|
689
741
|
"[R_ANGLE]": {
|
|
690
742
|
"type": "reduce",
|
|
691
|
-
"value":
|
|
743
|
+
"value": 19
|
|
692
744
|
},
|
|
693
745
|
"[COLON]": {
|
|
694
746
|
"type": "reduce",
|
|
695
|
-
"value":
|
|
747
|
+
"value": 19
|
|
696
748
|
},
|
|
697
749
|
"[R_BRACKET]": {
|
|
698
750
|
"type": "reduce",
|
|
699
|
-
"value":
|
|
751
|
+
"value": 19
|
|
700
752
|
}
|
|
701
753
|
}
|
|
702
754
|
];
|
|
@@ -1183,7 +1235,121 @@ export const states = [
|
|
|
1183
1235
|
"type": 0
|
|
1184
1236
|
},
|
|
1185
1237
|
"identifier": "[QUESTION_MARK]",
|
|
1186
|
-
"name": "
|
|
1238
|
+
"name": "modifier"
|
|
1239
|
+
}
|
|
1240
|
+
]
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
"lhs": {
|
|
1244
|
+
"column": 1,
|
|
1245
|
+
"lexeme": "TOKEN",
|
|
1246
|
+
"line": 7,
|
|
1247
|
+
"type": 0
|
|
1248
|
+
},
|
|
1249
|
+
"identifier": "<TOKEN>",
|
|
1250
|
+
"name": "grouped_token",
|
|
1251
|
+
"originalProductionIndex": 6,
|
|
1252
|
+
"rhs": [
|
|
1253
|
+
{
|
|
1254
|
+
"type": "terminal",
|
|
1255
|
+
"token": {
|
|
1256
|
+
"column": 25,
|
|
1257
|
+
"lexeme": "L_PAREN",
|
|
1258
|
+
"line": 7,
|
|
1259
|
+
"type": 0
|
|
1260
|
+
},
|
|
1261
|
+
"identifier": "[L_PAREN]",
|
|
1262
|
+
"name": null
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
"type": "variable",
|
|
1266
|
+
"token": {
|
|
1267
|
+
"column": 35,
|
|
1268
|
+
"lexeme": "TOKENS",
|
|
1269
|
+
"line": 7,
|
|
1270
|
+
"type": 0
|
|
1271
|
+
},
|
|
1272
|
+
"identifier": "<TOKENS>",
|
|
1273
|
+
"name": "tokens"
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
"type": "terminal",
|
|
1277
|
+
"token": {
|
|
1278
|
+
"column": 52,
|
|
1279
|
+
"lexeme": "R_PAREN",
|
|
1280
|
+
"line": 7,
|
|
1281
|
+
"type": 0
|
|
1282
|
+
},
|
|
1283
|
+
"identifier": "[R_PAREN]",
|
|
1284
|
+
"name": null
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"type": "terminal",
|
|
1288
|
+
"token": {
|
|
1289
|
+
"column": 78,
|
|
1290
|
+
"lexeme": "PLUS",
|
|
1291
|
+
"line": 7,
|
|
1292
|
+
"type": 0
|
|
1293
|
+
},
|
|
1294
|
+
"identifier": "[PLUS]",
|
|
1295
|
+
"name": "modifier"
|
|
1296
|
+
}
|
|
1297
|
+
]
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
"lhs": {
|
|
1301
|
+
"column": 1,
|
|
1302
|
+
"lexeme": "TOKEN",
|
|
1303
|
+
"line": 7,
|
|
1304
|
+
"type": 0
|
|
1305
|
+
},
|
|
1306
|
+
"identifier": "<TOKEN>",
|
|
1307
|
+
"name": "grouped_token",
|
|
1308
|
+
"originalProductionIndex": 6,
|
|
1309
|
+
"rhs": [
|
|
1310
|
+
{
|
|
1311
|
+
"type": "terminal",
|
|
1312
|
+
"token": {
|
|
1313
|
+
"column": 25,
|
|
1314
|
+
"lexeme": "L_PAREN",
|
|
1315
|
+
"line": 7,
|
|
1316
|
+
"type": 0
|
|
1317
|
+
},
|
|
1318
|
+
"identifier": "[L_PAREN]",
|
|
1319
|
+
"name": null
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
"type": "variable",
|
|
1323
|
+
"token": {
|
|
1324
|
+
"column": 35,
|
|
1325
|
+
"lexeme": "TOKENS",
|
|
1326
|
+
"line": 7,
|
|
1327
|
+
"type": 0
|
|
1328
|
+
},
|
|
1329
|
+
"identifier": "<TOKENS>",
|
|
1330
|
+
"name": "tokens"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
"type": "terminal",
|
|
1334
|
+
"token": {
|
|
1335
|
+
"column": 52,
|
|
1336
|
+
"lexeme": "R_PAREN",
|
|
1337
|
+
"line": 7,
|
|
1338
|
+
"type": 0
|
|
1339
|
+
},
|
|
1340
|
+
"identifier": "[R_PAREN]",
|
|
1341
|
+
"name": null
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
"type": "terminal",
|
|
1345
|
+
"token": {
|
|
1346
|
+
"column": 85,
|
|
1347
|
+
"lexeme": "STAR",
|
|
1348
|
+
"line": 7,
|
|
1349
|
+
"type": 0
|
|
1350
|
+
},
|
|
1351
|
+
"identifier": "[STAR]",
|
|
1352
|
+
"name": "modifier"
|
|
1187
1353
|
}
|
|
1188
1354
|
]
|
|
1189
1355
|
},
|