-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPrinting according to Kind Names.i7x
2403 lines (1995 loc) · 148 KB
/
Printing according to Kind Names.i7x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Version 1 of Printing according to Kind Names (for Glulx only) by Brady Garvin begins here.
"Validates and prints values according to kinds given by name."
Include Compiler Version Checks by Brady Garvin.
Include Runtime Checks by Brady Garvin.
Include Low-Level Operations by Brady Garvin.
Include Low-Level Text by Brady Garvin.
Include Low-Level Linked Lists by Brady Garvin.
Include Low-Level Hash Tables by Brady Garvin.
Include Glulx Text Decoding by Brady Garvin.
Include Punctuated Word Parsing Engine by Brady Garvin.
Include Disambiguation Framework by Brady Garvin.
Include Human-Friendly Function Names by Brady Garvin.
Include Debug File Parsing by Brady Garvin.
Use authorial modesty.
Book "Copyright and License"
[Copyright 2013 Brady J. Garvin]
[This extension is released under the Creative Commons Attribution 3.0 Unported License (CC BY 3.0) so that it can qualify as a public Inform extension. See the LICENSE file included in the release for further details.]
Book "Extension Information"
Chapter "Use Options" - unindexed
Use a kind name hash table size of at least 311 translates as (- Constant PKN_NAME_HASH_SIZE={N}; -).
To decide what number is the kind name hash table size: (- PKN_NAME_HASH_SIZE -).
Chapter "Rulebooks"
The kind printing setup rules are [rulebook is] a rulebook.
Chapter "Temporary Workarounds" - unindexed
To decide whether the understood value (X - a number) with the base kind code (C - a number) is valid in the command (T - some text) using a workaround for Inform bug 825:
decide on whether or not the understood value X with the base kind code C is valid in the command T.
To say the understood value (X - a number) with the base kind code (C - a number) in the command (T - some text) using a workaround for Inform bug 825:
say "[the understood value X with the base kind code C in the command T]".
To decide what text is the validation error for (X - a number) using the kind parse rooted at (V - a parse tree vertex) and a workaround for Inform bug 848:
decide on the validation error for X using the kind parse rooted at V.
To say the kind parse rooted at (V - a parse tree vertex) with plural flag (F - a truth state) and a workaround for Inform bug 848:
say "[the kind parse rooted at V with plural flag F]".
Book "Runtime Checks"
Chapter "Messages" - unindexed
To fail at building a semi-punctuated word array from changing text:
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I tried to build a semi-punctuated word array from some text, which means first counting the number of words and then recording each of them. But the recording process came up with a different number of words than I had originally counted, which means that this text is changing as I print it.[terminating the story]".
To fail at finding kind parameters in (V - a parse tree vertex):
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was trying to print a value with a given parameterized kind, like 'list of _', but I wasn't able to fill in the blank. In case it's helpful, the kind parse tree looked like this:[paragraph break][V converted to a parse tree vertex with indentation][terminating the story]".
To fail at finding the expected number of children when canonicalizing parse tree vertices for rules and rulebooks:
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was cleaning up my parse of a kind name and found more parameterization of a rule or rulebook kind than should be possible. That means that my canonicalization code, which performs that clean-up, must have failed recently.[terminating the story]".
To fail at saying a value according to a nonexistent previous kind name parse:
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was asked to say a value according to the most recently parsed kind name, but there way no most recently parsed kind name.[terminating the story]".
To fail at saying a nonexistent previous kind name parse:
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was asked to say the most recently parsed kind name, but there way no most recently parsed kind name.[terminating the story]".
To fail at saying a previous kind name parse that was not understood:
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was asked to say the most recently parsed kind name unambiguously, but I didn't understand it, so I can't then identify or remove any ambiguities.[terminating the story]".
To fail at saying a kind because of (S - a parseme):
say "[low-level runtime failure in]Printing according to Kind Names[with explanation]I was asked to say a kind, but was unable to find all of the entries in my kind name bookkeeping; it might be corrupted. In case it's helpful, one offending parseme was [S converted to a parseme].[terminating the story]".
Book "Forced Inclusion of the Block Value Management Routines" - unindexed
The variable that forces inclusion of the block value management routines is some indexed text that varies.
Book "Kind Name Parsing" - unindexed
Chapter "The Kind Name Parser" - unindexed
The kind name parser is a context-free parser that varies.
Chapter "Kind Name Parsemes" - unindexed
A kind in the singular and
a kind in the plural and
a kind preferably in the singular and
a kind preferably in the plural and
a kind pedantically in the plural [for cases where Inform would use the plural but a human would probably use the singular] and
an optional kind preferably in the singular and
an optional kind preferably in the plural and
an optional kind pedantically in the plural and
a list of kinds and
a nonempty list of kinds and
a nothing kind and
a nothing meaning action kind and
a nonkind in the singular and
a truth state in the singular and
a truth state in the plural and
a rulebook outcome in the singular and
a rulebook outcome in the plural and
a number in the singular and
a number in the plural and
a time in the singular and
a time in the plural and
a value in the singular and
a value in the plural and
a value in the particular singular and
a value in the particular plural and
a use option in the singular and
a use option in the plural and
a Unicode character in the singular and
a Unicode character in the plural and
a text in the singular and
a text in the plural and
an indexed text in the singular and
an indexed text in the plural and
a snippet in the singular and
a snippet in the plural and
a topic in the singular and
a topic in the plural and
an action name in the singular and
an action name in the plural and
a stored action in the singular and
a stored action in the plural and
a scene in the singular and
a scene in the plural and
a figure name in the singular and
a figure name in the plural and
a sound name in the singular and
a sound name in the plural and
an external file in the singular and
an external file in the plural and
a list in the singular and
a list in the plural and
a table name in the singular and
a table name in the plural and
a table column in the singular and
a table column in the plural and
an equation name in the singular and
an equation name in the plural and
a relation in the singular and
a relation in the plural and
an object in the singular and
an object in the plural and
an object in the particular singular and
an object in the particular plural and
an either/or property in the singular and
an either/or property in the plural and
a valued property in the singular and
a valued property in the plural and
a description in the singular and
a description in the plural and
a phrase in the singular and
a phrase in the plural and
a routine in the singular and
a routine in the plural and
a rule in the singular and
a based rule in the singular and
a rule in the plural and
a based rule in the plural and
a rulebook in the singular and
a based rulebook in the singular and
a rulebook in the plural and
a based rulebook in the plural and
an activity in the singular and
an activity in the plural are parsemes that vary.
Chapter "Kind Name Printing Hash Tables" - unindexed
[Maps kind parsemes to the singular and plural names (without articles) for their kinds, unless those names are parameterized.]
The singular kind name hash table is a hash table that varies.
The plural kind name hash table is a hash table that varies.
To associate the kind name parseme (S - a parseme) with the singular (T - some text) and the plural (U - some text):
insert the key S and the value T into the singular kind name hash table;
insert the key S and the value U into the plural kind name hash table.
To decide what text is the kind name for (S - a parseme) with plural flag (F - a truth state):
let the result be some text;
if F is true:
now the result is the first text value matching the key S in the plural kind name hash table or "" if there are no matches;
otherwise:
now the result is the first text value matching the key S in the singular kind name hash table or "" if there are no matches;
if the result is empty:
fail at saying a kind because of S;
decide on the result.
Chapter "Kind Name Parser Setup and Grammar" - unindexed
The global for saying a custom kind name is some text that varies.
A kind printing setup rule (this is the set up the kind name parser rule):
now the kind name parser is a new context-free parser;
now the singular kind name hash table is a new hash table with the kind name hash table size buckets;
now the plural kind name hash table is a new hash table with the kind name hash table size buckets;
now a kind in the singular is a new nonterminal in the kind name parser named "a kind (written in the singular)";
now a kind in the plural is a new nonterminal in the kind name parser named "a kind (written in the plural)";
now a kind preferably in the singular is a new nonterminal in the kind name parser named "a kind";
now a kind preferably in the plural is a new nonterminal in the kind name parser named "a kind";
now a kind pedantically in the plural is a new nonterminal in the kind name parser named "a kind";
now an optional kind preferably in the singular is a new nonterminal in the kind name parser named "an optional kind";
now an optional kind preferably in the plural is a new nonterminal in the kind name parser named "an optional kind";
now an optional kind pedantically in the plural is a new nonterminal in the kind name parser named "an optional kind";
now a list of kinds is a new nonterminal in the kind name parser named "a (possibly empty) list of kinds";
now a nonempty list of kinds is a new nonterminal in the kind name parser named "a partial list of kinds";
now a nothing kind is a new nonterminal in the kind name parser named "nothing";
associate the kind name parseme a nothing kind with the singular "nothing" and the plural "nothing";
now a nothing meaning action kind is a new nonterminal in the kind name parser named "action";
associate the kind name parseme a nothing meaning action kind with the singular "action" and the plural "action";
now a nonkind in the singular is a new nonterminal in the kind name parser named "an unknown or absent kind";
associate the kind name parseme a nonkind in the singular with the singular "<unknown kind>" and the plural "<unknown kind>";
now a truth state in the singular is a new nonterminal in the kind name parser named "a truth state";
associate the kind name parseme a truth state in the singular with the singular "truth state" and the plural "truth states";
now a truth state in the plural is a new nonterminal in the kind name parser named "truth states";
associate the kind name parseme a truth state in the plural with the singular "truth state" and the plural "truth states";
now a rulebook outcome in the singular is a new nonterminal in the kind name parser named "a rulebook outcome";
associate the kind name parseme a rulebook outcome in the singular with the singular "rulebook outcome" and the plural "a rulebook outcomes";
now a rulebook outcome in the plural is a new nonterminal in the kind name parser named "rulebook outcomes";
associate the kind name parseme a rulebook outcome in the plural with the singular "rulebook outcome" and the plural "rulebook outcomes";
now a number in the singular is a new nonterminal in the kind name parser named "a number";
associate the kind name parseme a number in the singular with the singular "number" and the plural "numbers";
now a number in the plural is a new nonterminal in the kind name parser named "numbers";
associate the kind name parseme a number in the plural with the singular "number" and the plural "numbers";
now a time in the singular is a new nonterminal in the kind name parser named "a time";
associate the kind name parseme a time in the singular with the singular "time" and the plural "times";
now a time in the plural is a new nonterminal in the kind name parser named "times";
associate the kind name parseme a time in the plural with the singular "time" and the plural "times";
now a value in the singular is a new nonterminal in the kind name parser named "a custom kind of value";
now a value in the plural is a new nonterminal in the kind name parser named "a custom kind of value";
now a use option in the singular is a new nonterminal in the kind name parser named "a use option";
associate the kind name parseme a use option in the singular with the singular "use option" and the plural "use options";
now a use option in the plural is a new nonterminal in the kind name parser named "use options";
associate the kind name parseme a use option in the plural with the singular "use option" and the plural "use options";
now a Unicode character in the singular is a new nonterminal in the kind name parser named "a Unicode character";
associate the kind name parseme a Unicode character in the singular with the singular "Unicode character" and the plural "Unicode characters";
now a Unicode character in the plural is a new nonterminal in the kind name parser named "Unicode characters";
associate the kind name parseme a Unicode character in the plural with the singular "Unicode character" and the plural "Unicode characters";
now a text in the singular is a new nonterminal in the kind name parser named "a text";
associate the kind name parseme a text in the singular with the singular "text" and the plural "texts";
now a text in the plural is a new nonterminal in the kind name parser named "texts";
associate the kind name parseme a text in the plural with the singular "text" and the plural "texts";
now an indexed text in the singular is a new nonterminal in the kind name parser named "an indexed text";
associate the kind name parseme an indexed text in the singular with the singular "indexed text" and the plural "indexed texts";
now an indexed text in the plural is a new nonterminal in the kind name parser named "indexed texts";
associate the kind name parseme an indexed text in the plural with the singular "indexed text" and the plural "indexed texts";
now a snippet in the singular is a new nonterminal in the kind name parser named "a snippet";
associate the kind name parseme a snippet in the singular with the singular "snippet" and the plural "snippets";
now a snippet in the plural is a new nonterminal in the kind name parser named "snippets";
associate the kind name parseme a snippet in the plural with the singular "snippet" and the plural "snippets";
now a topic in the singular is a new nonterminal in the kind name parser named "a topic";
associate the kind name parseme a topic in the singular with the singular "topic" and the plural "topics";
now a topic in the plural is a new nonterminal in the kind name parser named "topics";
associate the kind name parseme a topic in the plural with the singular "topic" and the plural "topics";
now an action name in the singular is a new nonterminal in the kind name parser named "an action name";
associate the kind name parseme an action name in the singular with the singular "action name" and the plural "action names";
now an action name in the plural is a new nonterminal in the kind name parser named "action names";
associate the kind name parseme an action name in the plural with the singular "action name" and the plural "action names";
now a stored action in the singular is a new nonterminal in the kind name parser named "a stored action";
associate the kind name parseme a stored action in the singular with the singular "stored action" and the plural "stored actions";
now a stored action in the plural is a new nonterminal in the kind name parser named "stored actions";
associate the kind name parseme a stored action in the plural with the singular "stored action" and the plural "stored actions";
now a scene in the singular is a new nonterminal in the kind name parser named "a scene";
associate the kind name parseme a scene in the singular with the singular "scene" and the plural "scenes";
now a scene in the plural is a new nonterminal in the kind name parser named "scenes";
associate the kind name parseme a scene in the plural with the singular "scene" and the plural "scenes";
now a figure name in the singular is a new nonterminal in the kind name parser named "a figure name";
associate the kind name parseme a figure name in the singular with the singular "figure name" and the plural "figure names";
now a figure name in the plural is a new nonterminal in the kind name parser named "figure names";
associate the kind name parseme a figure name in the plural with the singular "figure name" and the plural "figure names";
now a sound name in the singular is a new nonterminal in the kind name parser named "a sound name";
associate the kind name parseme a sound name in the singular with the singular "sound name" and the plural "sound names";
now a sound name in the plural is a new nonterminal in the kind name parser named "sound names";
associate the kind name parseme a sound name in the plural with the singular "sound name" and the plural "sound names";
now an external file in the singular is a new nonterminal in the kind name parser named "an external file";
associate the kind name parseme an external file in the singular with the singular "external file" and the plural "external files";
now an external file in the plural is a new nonterminal in the kind name parser named "external files";
associate the kind name parseme an external file in the plural with the singular "external file" and the plural "external files";
now a list in the singular is a new nonterminal in the kind name parser named "a list";
now a list in the plural is a new nonterminal in the kind name parser named "lists";
now a table name in the singular is a new nonterminal in the kind name parser named "a table name";
associate the kind name parseme a table name in the singular with the singular "table name" and the plural "table names";
now a table name in the plural is a new nonterminal in the kind name parser named "table names";
associate the kind name parseme a table name in the plural with the singular "table name" and the plural "table names";
now a table column in the singular is a new nonterminal in the kind name parser named "a table column";
now a table column in the plural is a new nonterminal in the kind name parser named "table columns";
now an equation name in the singular is a new nonterminal in the kind name parser named "an equation name";
associate the kind name parseme an equation name in the singular with the singular "equation name" and the plural "equation names";
now an equation name in the plural is a new nonterminal in the kind name parser named "equation names";
associate the kind name parseme an equation name in the plural with the singular "equation name" and the plural "equation names";
now a relation in the singular is a new nonterminal in the kind name parser named "a relation";
now a relation in the plural is a new nonterminal in the kind name parser named "relations";
now an object in the singular is a new nonterminal in the kind name parser named "a kind of object";
associate the kind name parseme an object in the singular with the singular "object" and the plural "objects";
now an object in the plural is a new nonterminal in the kind name parser named "a kind of object";
associate the kind name parseme an object in the plural with the singular "object" and the plural "objects";
now an either/or property in the singular is a new nonterminal in the kind name parser named "an either/or property";
associate the kind name parseme an either/or property in the singular with the singular "either/or property" and the plural "either/or properties";
now an either/or property in the plural is a new nonterminal in the kind name parser named "either/or properties";
associate the kind name parseme an either/or property in the plural with the singular "either/or property" and the plural "either/or properties";
now a valued property in the singular is a new nonterminal in the kind name parser named "a valued property";
now a valued property in the plural is a new nonterminal in the kind name parser named "valued properties";
now a description in the singular is a new nonterminal in the kind name parser named "a description";
now a description in the plural is a new nonterminal in the kind name parser named "descriptions";
now a phrase in the singular is a new nonterminal in the kind name parser named "a phrase";
now a phrase in the plural is a new nonterminal in the kind name parser named "phrases";
now a routine in the singular is a new nonterminal in the kind name parser named "a routine";
associate the kind name parseme a routine in the singular with the singular "routine" and the plural "routines";
now a routine in the plural is a new nonterminal in the kind name parser named "routines";
associate the kind name parseme a routine in the plural with the singular "routine" and the plural "routines";
now a rule in the singular is a new nonterminal in the kind name parser named "a rule";
now a based rule in the singular is a new nonterminal in the kind name parser named "a rule with its basis given";
now a rule in the plural is a new nonterminal in the kind name parser named "rules";
now a based rule in the plural is a new nonterminal in the kind name parser named "rules with their basis given";
now a rulebook in the singular is a new nonterminal in the kind name parser named "a rulebook";
now a based rulebook in the singular is a new nonterminal in the kind name parser named "a rulebook with its basis given";
now a rulebook in the plural is a new nonterminal in the kind name parser named "rulebooks";
now a based rulebook in the plural is a new nonterminal in the kind name parser named "rulebooks with their basis given";
now an activity in the singular is a new nonterminal in the kind name parser named "an activity";
now an activity in the plural is a new nonterminal in the kind name parser named "activities";
[//]
understand "([a kind in the singular])" as a kind in the singular;
understand "a [a kind in the singular]" or "an [a kind in the singular]" as a kind in the singular regardless of case;
understand "([a kind in the plural])" as a kind in the plural;
understand "some [a kind in the plural]" as a kind in the plural regardless of case;
[//]
understand "[a kind in the singular]" or "[a kind in the plural]" as a kind preferably in the singular;
understand "[a kind in the singular]" or "[a kind in the plural]" as a kind preferably in the plural;
understand "[a kind in the singular]" or "[a kind in the plural]" as a kind pedantically in the plural;
understand "[a kind preferably in the singular]" or "[a nothing kind]" as an optional kind preferably in the singular;
understand "[a kind preferably in the plural]" or "[a nothing kind]" as an optional kind preferably in the plural;
understand "[a kind pedantically in the plural]" or "[a nothing kind]" as an optional kind pedantically in the plural;
[//]
understand "[a nothing kind]" or "[a nonempty list of kinds]" as a list of kinds regardless of case;
understand "([a list of kinds])" as a list of kinds;
understand "[a kind preferably in the singular]" as a nonempty list of kinds regardless of case;
understand "[a kind preferably in the singular], [a nonempty list of kinds]" as a nonempty list of kinds;
[//]
understand "nothing" as a nothing kind regardless of case;
[//]
understand "[a nonkind in the singular]" as a kind in the singular;
understand "[a truth state in the singular]" as a kind in the singular;
understand "[a rulebook outcome in the singular]" as a kind in the singular;
understand "[a number in the singular]" as a kind in the singular;
understand "[a time in the singular]" as a kind in the singular;
understand "[a value in the singular]" as a kind in the singular;
understand "[a use option in the singular]" as a kind in the singular;
understand "[a Unicode character in the singular]" as a kind in the singular;
understand "[a text in the singular]" as a kind in the singular;
understand "[an indexed text in the singular]" as a kind in the singular;
understand "[a snippet in the singular]" as a kind in the singular;
understand "[a topic in the singular]" as a kind in the singular;
understand "[an action name in the singular]" as a kind in the singular;
understand "[a stored action in the singular]" as a kind in the singular;
understand "[a scene in the singular]" as a kind in the singular;
understand "[a figure name in the singular]" as a kind in the singular;
understand "[a sound name in the singular]" as a kind in the singular;
understand "[an external file in the singular]" as a kind in the singular;
understand "[a list in the singular]" as a kind in the singular;
understand "[a table name in the singular]" as a kind in the singular;
understand "[a table column in the singular]" as a kind in the singular;
understand "[an equation name in the singular]" as a kind in the singular;
understand "[a relation in the singular]" as a kind in the singular;
understand "[an object in the singular]" as a kind in the singular;
understand "[an either/or property in the singular]" as a kind in the singular;
understand "[a valued property in the singular]" as a kind in the singular;
understand "[a description in the singular]" as a kind in the singular;
understand "[a phrase in the singular]" as a kind in the singular;
understand "[a routine in the singular]" as a kind in the singular;
understand "[a rule in the singular]" as a kind in the singular;
understand "[a rulebook in the singular]" as a kind in the singular;
understand "[an activity in the singular]" as a kind in the singular;
[//]
understand "[a truth state in the plural]" as a kind in the plural;
understand "[a rulebook outcome in the plural]" as a kind in the plural;
understand "[a number in the plural]" as a kind in the plural;
understand "[a time in the plural]" as a kind in the plural;
understand "[a value in the plural]" as a kind in the plural;
understand "[a use option in the plural]" as a kind in the plural;
understand "[a Unicode character in the plural]" as a kind in the plural;
understand "[a text in the plural]" as a kind in the plural;
understand "[an indexed text in the plural]" as a kind in the plural;
understand "[a snippet in the plural]" as a kind in the plural;
understand "[a topic in the plural]" as a kind in the plural;
understand "[an action name in the plural]" as a kind in the plural;
understand "[a stored action in the plural]" as a kind in the plural;
understand "[a scene in the plural]" as a kind in the plural;
understand "[a figure name in the plural]" as a kind in the plural;
understand "[a sound name in the plural]" as a kind in the plural;
understand "[an external file in the plural]" as a kind in the plural;
understand "[a list in the plural]" as a kind in the plural;
understand "[a table name in the plural]" as a kind in the plural;
understand "[a table column in the plural]" as a kind in the plural;
understand "[an equation name in the plural]" as a kind in the plural;
understand "[a relation in the plural]" as a kind in the plural;
understand "[an object in the plural]" as a kind in the plural;
understand "[an either/or property in the plural]" as a kind in the plural;
understand "[a valued property in the plural]" as a kind in the plural;
understand "[a description in the plural]" as a kind in the plural;
understand "[a phrase in the plural]" as a kind in the plural;
understand "[a routine in the plural]" as a kind in the plural;
understand "[a rule in the plural]" as a kind in the plural;
understand "[a rulebook in the plural]" as a kind in the plural;
understand "[an activity in the plural]" as a kind in the plural;
[//]
understand "<no kind>" or "<unknown kind>" as a nonkind in the singular regardless of case;
understand "truth state" as a truth state in the singular regardless of case;
understand "truth states" as a truth state in the plural regardless of case;
understand "rulebook outcome" as a rulebook outcome in the singular regardless of case;
understand "rulebook outcomes" as a rulebook outcome in the plural regardless of case;
understand "number" as a number in the singular regardless of case;
understand "numbers" as a number in the plural regardless of case;
understand "time" as a time in the singular regardless of case;
understand "times" as a time in the plural regardless of case;
understand "use option" as a use option in the singular regardless of case;
understand "use options" as a use option in the plural regardless of case;
understand "Unicode character" as a Unicode character in the singular regardless of case;
understand "Unicode characters" as a Unicode character in the plural regardless of case;
understand "text" as a text in the singular regardless of case;
understand "text" as a text in the plural regardless of case; [since it can be used as a mass noun]
understand "texts" as a text in the plural regardless of case;
understand "indexed text" as an indexed text in the singular regardless of case;
understand "indexed texts" as an indexed text in the plural regardless of case;
understand "snippet" as a snippet in the singular regardless of case;
understand "snippets" as a snippet in the plural regardless of case;
understand "topic" as a topic in the singular regardless of case;
understand "topics" as a topic in the plural regardless of case;
understand "action name" as an action name in the singular regardless of case;
understand "action names" as an action name in the plural regardless of case;
understand "stored action" as a stored action in the singular regardless of case;
understand "stored actions" as a stored action in the plural regardless of case;
understand "scene" as a scene in the singular regardless of case;
understand "scenes" as a scene in the plural regardless of case;
understand "figure name" as a figure name in the singular regardless of case;
understand "figure names" as a figure name in the plural regardless of case;
understand "sound name" as a sound name in the singular regardless of case;
understand "sound names" as a sound name in the plural regardless of case;
understand "external file" as an external file in the singular regardless of case;
understand "external files" as an external file in the plural regardless of case;
understand "table name" as a table name in the singular regardless of case;
understand "table names" as a table name in the plural regardless of case;
understand "equation name" as an equation name in the singular regardless of case;
understand "equation names" as an equation name in the plural regardless of case;
understand "either/or property" as an either/or property in the singular regardless of case;
understand "either/or properties" as an either/or property in the plural regardless of case;
[//]
repeat with the kind-of-value name running through the underlying text keys of the kind-of-value hash table:
now a value in the particular singular is a new nonterminal in the kind name parser named "a custom kind of value";
now the global for saying a custom kind name is the kind-of-value name;
understand "[the global for saying a custom kind name]" as a value in the particular singular regardless of case;
understand "[a value in the particular singular]" as a value in the singular;
associate the kind name parseme a value in the particular singular with the singular the kind-of-value name and the plural the debug plural of the kind-of-value name;
now a value in the particular plural is a new nonterminal in the kind name parser named "a custom kind of value";
now the global for saying a custom kind name is the debug plural of the kind-of-value name;
understand "[the global for saying a custom kind name]" as a value in the particular plural regardless of case;
understand "[a value in the particular plural]" as a value in the plural;
associate the kind name parseme a value in the particular plural with the singular the kind-of-value name and the plural the debug plural of the kind-of-value name;
[//]
understand "object" as an object in the singular regardless of case;
understand "objects" as an object in the plural regardless of case;
understand "room" as an object in the singular regardless of case;
understand "rooms" as an object in the plural regardless of case;
understand "thing" as an object in the singular regardless of case;
understand "things" as an object in the plural regardless of case;
understand "direction" as an object in the singular regardless of case;
understand "directions" as an object in the plural regardless of case;
understand "region" as an object in the singular regardless of case;
understand "regions" as an object in the plural regardless of case;
repeat with the kind-of-object name running through the underlying text keys of the kind-of-object hash table:
now an object in the particular singular is a new nonterminal in the kind name parser named "a custom kind of object";
now the global for saying a custom kind name is the kind-of-object name;
understand "[the global for saying a custom kind name]" as an object in the particular singular regardless of case;
understand "[an object in the particular singular]" as an object in the singular;
associate the kind name parseme an object in the particular singular with the singular the kind-of-object name and the plural the debug plural of the kind-of-object name;
now an object in the particular plural is a new nonterminal in the kind name parser named "a custom kind of object";
now the global for saying a custom kind name is the debug plural of the kind-of-object name;
understand "[the global for saying a custom kind name]" as an object in the particular plural regardless of case;
understand "[an object in the particular plural]" as an object in the plural;
associate the kind name parseme an object in the particular plural with the singular the kind-of-object name and the plural the debug plural of the kind-of-object name;
[//]
understand "list of [a kind preferably in the plural]" as a list in the singular regardless of case;
understand "lists of [a kind preferably in the plural]" as a list in the plural regardless of case;
understand "[a kind pedantically in the plural] valued table column" as a table column in the singular regardless of case;
understand "[a kind pedantically in the plural] valued table columns" as a table column in the plural regardless of case;
understand "relation of [a kind preferably in the plural] to [a kind preferably in the plural]" as a relation in the singular regardless of case;
understand "relations of [a kind preferably in the plural] to [a kind preferably in the plural]" as a relation in the plural regardless of case;
understand "[a kind pedantically in the plural] valued property" as a valued property in the singular regardless of case;
understand "[a kind pedantically in the plural] valued properties" as a valued property in the plural regardless of case;
understand "description of [a kind preferably in the plural]" as a description in the singular regardless of case;
understand "descriptions of [a kind preferably in the plural]" as a description in the plural regardless of case;
understand "phrase [a list of kinds] -> [an optional kind preferably in the singular]" as a phrase in the singular regardless of case;
understand "phrases [a list of kinds] -> [an optional kind preferably in the singular]" as a phrase in the plural regardless of case;
understand "routine" as a routine in the singular regardless of case;
understand "routines" as a routine in the plural regardless of case;
understand "rule" as a rule in the singular regardless of case;
understand "action based rule" as a rule in the singular regardless of case;
understand "rule producing [an optional kind preferably in the plural]" as a rule in the singular regardless of case;
understand "action based rule producing [an optional kind preferably in the plural]" as a rule in the singular regardless of case;
understand "[a based rule in the singular]" as a rule in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rule" as a based rule in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rule producing [an optional kind preferably in the plural]" as a based rule in the singular regardless of case;
understand "rules" as a rule in the plural regardless of case;
understand "action based rules" as a rule in the plural regardless of case;
understand "rules producing [an optional kind preferably in the plural]" as a rule in the plural regardless of case;
understand "action based rules producing [an optional kind preferably in the plural]" as a rule in the plural regardless of case;
understand "[a based rule in the plural]" as a rule in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rules" as a based rule in the plural regardless of case;
understand "[an optional kind pedantically in the plural] based rules producing [an optional kind preferably in the plural]" as a based rule in the plural regardless of case;
understand "rulebook" as a rulebook in the singular regardless of case;
understand "action based rulebook" as a rulebook in the singular regardless of case;
understand "rulebook producing [an optional kind preferably in the plural]" as a rulebook in the singular regardless of case;
understand "action based rulebook producing [an optional kind preferably in the plural]" as a rulebook in the singular regardless of case;
understand "[a based rulebook in the singular]" as a rulebook in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rulebook" as a based rulebook in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rulebook producing [an optional kind preferably in the plural]" as a based rulebook in the singular regardless of case;
understand "rulebooks" as a rulebook in the plural regardless of case;
understand "action based rulebooks" as a rulebook in the plural regardless of case;
understand "rulebooks producing [an optional kind preferably in the plural]" as a rulebook in the plural regardless of case;
understand "action based rulebooks producing [an optional kind preferably in the plural]" as a rulebook in the plural regardless of case;
understand "[a based rulebook in the plural]" as a rulebook in the singular regardless of case;
understand "[an optional kind pedantically in the plural] based rulebooks" as a based rulebook in the plural regardless of case;
understand "[an optional kind pedantically in the plural] based rulebooks producing [an optional kind preferably in the plural]" as a based rulebook in the plural regardless of case;
understand "activity on [an optional kind preferably in the plural]" as an activity in the singular regardless of case;
understand "activities on [an optional kind preferably in the plural]" as an activity in the plural regardless of case;
[//]
put the kind name parser into normal form.
Chapter "Kind Name Canonicalization" - unindexed
The kind name canonicalization rules are [rulebook is] a rulebook.
A kind name canonicalization rule (this is the eliminate punctuated word terminals from kind parse trees rule):
let the previous child be a null parse tree vertex;
let the child be the first child of the parse tree vertex to canonicalize;
while the child is not null:
let the next child be the right sibling of the child;
if the parseme of the child is a punctuated word terminal:
delete the child and its descendants;
otherwise:
if the previous child is null:
write the first child the child to the parse tree vertex to canonicalize;
otherwise:
write the right sibling the child to the previous child;
write the left sibling the previous child to the child;
now the previous child is the child;
now the child is the next child;
if the previous child is null:
write the first child a null parse tree vertex to the parse tree vertex to canonicalize;
otherwise:
write the right sibling a null parse tree vertex to the previous child;
write the last child the previous child to the parse tree vertex to canonicalize.
A kind name canonicalization rule (this is the substitute into non-root placeholders in kind parse trees rule):
let the previous child be a null parse tree vertex;
let the child be the first child of the parse tree vertex to canonicalize;
while the child is not null:
let the next child be the right sibling of the child;
let the parseme be the parseme of the child;
if the parseme is a kind in the singular or the parseme is a kind in the plural or the parseme is a kind preferably in the singular or the parseme is a kind preferably in the plural or the parseme is a kind pedantically in the plural or the parseme is an optional kind preferably in the singular or the parseme is an optional kind preferably in the plural or the parseme is an optional kind pedantically in the plural or the parseme is list of kinds or the parseme is a nonempty list of kinds:
let the grandchild be the first child of the child;
delete the child but not its descendants;
if the grandchild is not null:
if the previous child is null:
write the first child the grandchild to the parse tree vertex to canonicalize;
otherwise:
write the right sibling the grandchild to the previous child;
write the left sibling the previous child to the grandchild;
while the grandchild is not null:
write the parent (the parse tree vertex to canonicalize) to the grandchild;
now the previous child is the grandchild;
now the grandchild is the right sibling of the grandchild;
otherwise:
if the previous child is null:
write the first child the child to the parse tree vertex to canonicalize;
otherwise:
write the right sibling the child to the previous child;
write the left sibling the previous child to the child;
now the previous child is the child;
now the child is the next child;
if the previous child is null:
write the first child a null parse tree vertex to the parse tree vertex to canonicalize;
otherwise:
write the right sibling a null parse tree vertex to the previous child;
write the last child the previous child to the parse tree vertex to canonicalize.
A last kind name canonicalization rule (this is the canonicalize rules and rulebooks in kind parse trees to two children rule):
let the parseme be the parseme of the parse tree vertex to canonicalize;
let the first child be the first child of the parse tree vertex to canonicalize;
let the last child be the last child of the parse tree vertex to canonicalize;
if the parseme is a based rule in the singular or the parseme is a based rule in the plural or the parseme is a based rulebook in the singular or the parseme is a based rulebook in the plural:
always check that first child is not null or else fail at finding the expected number of children when canonicalizing parse tree vertices for rules and rulebooks;
if the first child is the last child:
let the outcome child be a new parse tree vertex for a nothing kind with the parent the parse tree vertex to canonicalize;
otherwise:
always check that right sibling of the first child is the last child or else fail at finding the expected number of children when canonicalizing parse tree vertices for rules and rulebooks;
otherwise if the parseme is a rule in the singular or the parseme is a rule in the plural or the parseme is a rulebook in the singular or the parseme is a rulebook in the plural:
if the first child is null:
let the basis child be a new parse tree vertex for a nothing meaning action kind with the parent the parse tree vertex to canonicalize;
let the outcome child be a new parse tree vertex for a nothing kind with the parent the parse tree vertex to canonicalize;
otherwise if the first child is the last child:
now the parseme is the parseme of the first child;
if the parseme is a based rule in the singular or the parseme is a based rule in the plural or the parseme is a based rulebook in the singular or the parseme is a based rulebook in the plural:
let the basis child be the first child of the first child;
let the outcome child be the last child of the first child;
always check that right sibling of the basis child is the outcome child or else fail at finding the expected number of children when canonicalizing parse tree vertices for rules and rulebooks;
delete the first child but not its descendants;
write the first child the basis child to the parse tree vertex to canonicalize;
write the last child the outcome child to the parse tree vertex to canonicalize;
write the parent (the parse tree vertex to canonicalize) to the basis child;
write the parent (the parse tree vertex to canonicalize) to the outcome child;
otherwise:
let the basis child be a new parse tree vertex for a nothing meaning action kind with the parent the parse tree vertex to canonicalize, placed on the left;
otherwise:
always check that right sibling of the first child is the last child or else fail at finding the expected number of children when canonicalizing parse tree vertices for rules and rulebooks.
Chapter "Kind Name Scoring" - unindexed
The kind name scoring rules are [rulebook is] a rulebook.
Section "Pluralization Errors" - unindexed
To decide what number is the weighted pluralization error count of (V - a parse tree vertex):
decide on zero.
To decide what number is the weighted pluralization error count of (V - a parse tree vertex that has the parseme a kind preferably in the singular):
if the parseme of the first child of V is a kind in the singular:
decide on zero;
decide on two.
To decide what number is the weighted pluralization error count of (V - a parse tree vertex that has the parseme a kind preferably in the plural):
if the parseme of the first child of V is a kind in the plural:
decide on zero;
decide on two.
To decide what number is the weighted pluralization error count of (V - a parse tree vertex that has the parseme a kind pedantically in the plural):
[if the parseme of the first child of V is a kind in the plural:
decide on zero;
decide on one.] [Frankly, I find Inform's conventions here unusual enough that I'd rather not expect the author to know and follow them.]
decide on zero.
To decide what number is the weighted pluralization error count under (V - a parse tree vertex):
let the result be the weighted pluralization error count of V;
repeat with the child running through the children of V:
increase the result by the weighted pluralization error count under the child;
decide on the result.
A kind name scoring rule (this is the penalize pluralization errors rule):
let the result be the weighted pluralization error count under the root of the parse tree to score;
give the parse tree to score zero minus the result points for "pluralization errors".
Section "Value Validity" - unindexed
The kind name validity check flag is a truth state that varies.
The value to check kind name validity with is a number that varies.
A kind name scoring rule (this is the reward value validity rule):
if the kind name validity check flag is true:
if the value to check kind name validity with is completely valid using the kind parse rooted at the root of the canonicalized parse tree to score:
give the parse tree to score one point for "value validity";
otherwise:
give the parse tree to score zero points for "value validity".
Chapter "Kind Name Filtration" - unindexed
The kind name filtration rules are [rulebook is] a rulebook.
Book "Validation and Printing" - unindexed
Part "Kind Code Validation" - unindexed
To decide what number is the boolean base kind code: (- TRUTH_STATE_TY -).
To decide what number is the rulebook outcome base kind code: (- RULEBOOK_OUTCOME_TY -).
To decide what number is the number base kind code: (- NUMBER_TY -).
To decide what number is the dimensional number base kind code: (- INTERMEDIATE_TY -).
To decide what number is the use option base kind code: (- USE_OPTION_TY -).
To decide what number is the Unicode character base kind code: (- UNICODE_CHARACTER_TY -).
To decide what number is the text base kind code: (- TEXT_TY -).
To decide what number is the indexed text base kind code: (- INDEXED_TEXT_TY -).
To decide what number is the snippet base kind code: (- SNIPPET_TY -).
To decide what number is the understanding base kind code: (- UNDERSTANDING_TY -).
To decide what number is the list base kind code: (- LIST_OF_TY -).
To decide what number is the table name base kind code: (- TABLE_TY -).
To decide what number is the table column base kind code: (- TABLE_COLUMN_TY -).
To decide what number is the equation name base kind code: (- EQUATION_TY -).
To decide what number is the relation base kind code: (- RELATION_TY -).
To decide what number is the object base kind code: (- OBJECT_TY -).
To decide what number is the property base kind code: (- PROPERTY_TY -).
To decide what number is the description base kind code: (- DESCRIPTION_OF_TY -).
To decide what number is the phrase base kind code: (- PHRASE_TY -).
To decide what number is the rule base kind code: (- RULE_TY -).
To decide what number is the rulebook base kind code: (- RULEBOOK_TY -).
To decide what number is the activity base kind code: (- ACTIVITY_TY -).
Definition: a number is boolean-kind-identifying if it is the boolean base kind code.
Definition: a number is rulebook-outcome-kind-identifying if it is the rulebook outcome base kind code.
Definition: a number is number-kind-identifying if it is the number base kind code.
Definition: a number is dimensional-number-kind-identifying if it is the dimensional number base kind code.
Definition: a number is use-option-kind-identifying if it is the use option base kind code.
Definition: a number is Unicode-character-kind-identifying if it is the Unicode character base kind code.
Definition: a number is text-kind-identifying if it is the text base kind code.
Definition: a number is indexed text-kind-identifying if it is the indexed text base kind code.
Definition: a number is snippet-kind-identifying if it is the snippet base kind code.
Definition: a number is understanding-kind-identifying if it is the understanding base kind code.
Definition: a number is list-kind-identifying if it is the list base kind code.
Definition: a number is table-name-kind-identifying if it is the table name base kind code.
Definition: a number is table-column-kind-identifying if it is the table column base kind code.
Definition: a number is equation-name-kind-identifying if it is the equation name base kind code.
Definition: a number is relation-kind-identifying if it is the relation base kind code.
Definition: a number is object-kind-identifying if it is the object base kind code.
Definition: a number is property-kind-identifying if it is the property base kind code.
Definition: a number is description-kind-identifying if it is the description base kind code.
Definition: a number is phrase-kind-identifying if it is the phrase base kind code.
Definition: a number is rule-kind-identifying if it is the rule base kind code.
Definition: a number is rulebook-kind-identifying if it is the rulebook base kind code.
Definition: a number is activity-kind-identifying if it is the activity base kind code.
To decide whether the base kind code (C - a number) is legal: (- llo_unsignedLessThan({C},BASE_KIND_HWM) -).
To decide whether the kind code (C - a number) is legal:
if the base kind code C is legal:
decide yes;
decide on whether or not C is a valid integer address and the base kind code the integer at address C is legal.
To decide whether the kind code (C - a number) represents a phrase:
if C is the phrase base kind code:
decide yes;
decide on whether or not C is a valid integer address and the integer at address C is the phrase base kind code.
Part "Paranoid Text Manipulation" - unindexed
Chapter "Characters" - unindexed
[Almost completely covered by Glulx Text Decoding.]
To decide whether (A - a decoding vertex) is of indirect or unknown type: (- llo_unsignedGreaterThan(llo_getByte({A}),5) -).
Chapter "Text" - unindexed
Section "Text Validation" - unindexed
To decide whether (T - some text) could be substitution-free compressed text:
let the address be T converted to a number;
if the address is zero or the address is an invalid byte address or the byte at address address is not 225:
decide no;
repeat with the decoding vertex running with paranoia through the compressed T:
if the decoding vertex is of indirect or unknown type:
decide no;
decide yes.
To decide whether (T - some text) could be text:
let the address be T converted to a number;
if the address is zero or the address is an invalid byte address:
decide no;
let the indicator be the byte at address address;
if the indicator is:
-- 224: [null-terminated Latin-1]
let the maximum possible extent be the size of memory minus the address;
let the extent be the index of the byte zero in the maximum possible extent bytes at address address;
decide on whether or not the extent is at least zero;
-- 225: [compressed]
repeat with the decoding vertex running with paranoia through the compressed T:
if the decoding vertex is of unknown type:
decide no;
decide yes;
-- 226: [null-terminated Unicode]
let the maximum possible extent be the size of memory minus the address;
now the maximum possible extent is the maximum possible extent divided by four;
let the extent be the index of the integer zero in the maximum possible extent integers at address address;
decide on whether or not the extent is at least zero;
-- otherwise: [unknown]
decide on whether or not the indicator is a function type indicator.
Section "Text Printing" - unindexed
To say (T - some text) with paranoia:
let the address be T converted to a number;
if the byte at address address is:
-- 224: [null-terminated Latin-1]
repeat with the character running with paranoia through the Latin-1 T:
say "[if the character is printable][the character][otherwise]?[end if]";
-- 225: [compressed]
repeat with the decoding vertex running with paranoia through the compressed T:
say "[the decoding vertex]";
-- 226: [null-terminated Unicode]
repeat with the character running with paranoia through the Unicode T:
say "[if the character is printable][the character][otherwise]?[end if]";
-- otherwise: [must be a function type]
say "[the human-friendly name for the function at address address]".
Part "Paranoid Block Value Manipulation" - unindexed
Chapter "The Memory Block Kind" - unindexed
A memory block is a kind of value.
A memory block is an invalid memory block. [See the note in the book "Extension Information."]
The specification of a decoding vertex is "A memory block is a contiguous region of memory occupied by an Inform block value; blocks are defined by the BlockValues.i6t (and also Flex.i6t), which see."
Section "Memory Block Constants" - unindexed
To decide what memory block is the zero block: (- 0 -).
To decide what memory block is the null block: (- NULL -).
Section "The Memory Block Structure" - unindexed
[Layout:
<--BLK_HEADER_N is the byte offset to here; 0 bytes
1 byte for the binary logarithm of the block size
<--BLK_HEADER_FLAGS is the byte offset to here; 1 byte
1 byte for flags (BLK_FLAG_MULTIPLE, BLK_FLAG_16_BIT, BLK_FLAG_WORD, and/or BLK_FLAG_RESIDENT)
2 bytes padding
<--BLK_HEADER_KOV is the word offset to here; 1 word = 4 bytes
4 bytes for the base kind
<--BLK_DATA_OFFSET is the byte offset to here; 8 bytes
<--BLK_NEXT is the word offset to here; 2 words = 8 bytes
4 (optional) bytes for the next pointer of a multiblock header
<--BLK_PREV is the word offset to here; 3 words = 12 bytes
4 (optional) bytes for the previous pointer of a multiblock header]
Section "Memory Block Accessors" - unindexed
To decide what number is the size in memory of (A - a memory block): (- llo_leftShift(1,llo_getByte({A}+BLK_HEADER_N)) -).
To decide what number is the flags of (A - a memory block): (- llo_getByte({A}+BLK_HEADER_FLAGS) -).
To decide whether (A - a memory block) is a multiblock: (- (llo_getByte({A}+BLK_HEADER_FLAGS)&BLK_FLAG_MULTIPLE) -).
To decide what number is the base kind code of (A - a memory block): (- llo_getField({A},BLK_HEADER_KOV) -).
To decide what memory block is the memory block before (A - a memory block): (- llo_getField({A},BLK_PREV) -).
To decide what memory block is the memory block after (A - a memory block): (- llo_getField({A},BLK_NEXT) -).
To decide what number is the extent of (A - a memory block): (- BlkValueExtent({A}) -).
To decide what number is datum number (I - a number) of (A - a memory block): (- BlkValueRead({A},{I}) -).
Section "Memory Block Validation" - unindexed
To decide whether (A - a memory block) is valid:
if A is the null block or A is the zero block or A is an invalid memory block:
decide no;
let the maximum possible size be the size of memory minus A converted to a number;
if the maximum possible size is less than 16:
decide no;
let the size be the size in memory of A;
if the size is less than 16 or the size is greater than the maximum possible size:
decide no;
decide yes.
To decide whether (A - a memory block) is a valid head block:
unless A is valid:
decide no;
unless A is a multiblock:
decide yes;
if the memory block before A is not the null block:
decide no;
let the base kind code be the base kind code of A;
let the visited blocks hash table be a new hash table with 131 buckets;
let the current block be A;
repeat until a break:
insert the key the current block into the visited blocks hash table;
now the current block is the memory block after the current block;
if the current block is the null block:
delete the visited blocks hash table;
decide yes;
if the visited blocks hash table contains the key the current block or the base kind code of the current block is not the base kind code:
delete the visited blocks hash table;
decide no;
unless the current block is valid:
delete the visited blocks hash table;
decide no.
Part "Semi-Punctuated Words" - unindexed
Chapter "Character Classes" - unindexed
Include (-
Constant PKN_SEMI_PUNCTUATION_COUNT = 3;
Array pkn_semi_punctuation ->
34 ! "
44 ! ,
46 ! .
;
-) after "Definitions.i6t".
To decide whether (C - a number) is a character code for independent semi-punctuation: (- (llo_byteIndex({C},pkn_semi_punctuation,PKN_SEMI_PUNCTUATION_COUNT)~=-1) -).
Chapter "State Machine" - unindexed
A semi-punctuated word state is a kind of value.
The semi-punctuated word states are
transitioning after whitespace between semi-punctuated words,
transitioning after independent semi-punctuation,
and transitioning after non-semi-punctuation.
The specification of a semi-punctuated word state is "Semi-punctuated word states are used to classify between-character positions when Printing according to Kind Names breaks a command into snippet words."
To decide what semi-punctuated word state is the semi-punctuated word state that follows (C - a number):
if C is a character code for whitespace:
decide on transitioning after whitespace between semi-punctuated words;
if C is a character code for independent semi-punctuation:
decide on transitioning after independent semi-punctuation;
decide on transitioning after non-semi-punctuation.
To decide whether (A - a semi-punctuated word state) followed by (B - a semi-punctuated word state) ends a semi-punctuated word:
decide on whether or not A is transitioning after independent semi-punctuation or A is not transitioning after whitespace between semi-punctuated words and A is not B.
To decide whether (A - a semi-punctuated word state) followed by no semi-punctuated word state ends a semi-punctuated word:
decide on whether or not A is not transitioning after whitespace between semi-punctuated words.
To decide whether (A - a semi-punctuated word state) followed by (B - a semi-punctuated word state) begins a semi-punctuated word:
decide on whether or not B is transitioning after independent semi-punctuation or B is not transitioning after whitespace between semi-punctuated words and B is not A.
Chapter "Topic Match Values of Commands" - unindexed
To decide whether the topic match value (X - a number) of the command (T - some text) is valid, saying it:
let the beginning word number be X divided by 100;
let the end word number be the beginning word number plus the remainder after dividing X by 100;
let the current state be transitioning after whitespace between semi-punctuated words;
let the word index be one;
let the printing flag be false;
let the printed flag be false;
repeat with the character code running through the character codes in the synthetic text T:
let the previous state be the current state;
now the current state is the semi-punctuated word state that follows the character code;
if the previous state followed by the current state ends a semi-punctuated word:
increment the word index;
if the word index is at least the end word number:
now the printing flag is false;
if the previous state followed by the current state begins a semi-punctuated word:
if the word index is the beginning word number:
now the printing flag is true;
now the printed flag is true;
if saying it and the printing flag is true:
say "[the character code converted to a Unicode character]";
if the current state followed by no semi-punctuated word state ends a semi-punctuated word:
increment the word index;
if the word index is greater than the end word number:
now the printing flag is false;
decide on whether or not the printing flag is false and the printed flag is true.
To say the topic match value (X - a number) of the command (T - some text):
let the discarded value be whether or not the topic match value X of the command T is valid, saying it.
Part "Validation and Printing Phrases" - unindexed
Chapter "All Values" - unindexed
To say the kind parse rooted at (V - a parse tree vertex) with plural flag (F - a truth state):
say "[the kind name for the parseme of V with plural flag F]".
To say the kind parse rooted at (V - a parse tree vertex that has the parseme a kind in the singular) with plural flag (F - a truth state):
say "[the kind parse rooted at the first child of V with plural flag F and brackets as necessary]".
To decide what text is the validation error for (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a kind in the singular):
decide on the validation error for X using the kind parse rooted at the first child of V and a workaround for Inform bug 848.
To decide whether (X - a number) is completely valid using the kind parse rooted at (V - a parse tree vertex):
[//// Workaround for Inform bug ### ////]
if V has the parseme a list in the singular or V has the parseme a list in the plural:
decide on whether or not the list value X is completely valid using the kind parse rooted at V;
[//// Workaround for Inform bug ### ////]
let the error be the validation error for X using the kind parse rooted at V and a workaround for Inform bug 848;
decide on whether or not the error is empty.
To say (X - a number) using the kind parse rooted at (V - a parse tree vertex):
say "[the human-friendly name of the parseme of V]".
To say (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a kind in the singular):
say "[X using the kind parse rooted at the first child of V with paranoia]".
Chapter "Nonkind Values" - unindexed
To decide what text is the validation error for (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a nonkind in the singular):
decide on "".
To say (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a nonkind in the singular):
say "[X converted to a number] / [X converted to a number in hexadecimal]".
Chapter "Boolean Values" - unindexed
To decide what text is the validation error for the truth state value (X - a number):
decide on "".
To decide what text is the validation error for (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a truth state in the singular):
decide on the validation error for the truth state value X.
To decide what text is the validation error for (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a truth state in the plural):
decide on the validation error for the truth state value X.
To say the truth state value (X - a number): (- DA_TruthState({X}); -).
To say (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a truth state in the singular):
say "[the truth state value X]".
To say (X - a number) using the kind parse rooted at (V - a parse tree vertex that has the parseme a truth state in the plural):