-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlanguage_definition.brec
1235 lines (1058 loc) · 69 KB
/
language_definition.brec
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
Breccia language definition
- A Breccian text comprises one or more file fracta, each contained in a separate file.
│
│
├─────┐
╵ │
file │
fractum ▲
╷ │
├─────┘
│
│
▼
: re `(file).*(fractum)`s see `^+File fractum$`
diagram, The form of a Breccian text.
━━━━━━━━━━━━━
Afterlinker
─────────────
- An afterlinker formulates a connection between a subject just mentioned
and an object to which it refers the reader.
- A type of command point, its command has this form:
subject referential object
╶──┬── clause ── P ──┬── command ──┬── P ── clause ──┬───▶
│ │ │ │
└─────────────────┘ └─────────────────┘
diagram, The form of the command in an afterlinker.
────────────────
subject clause
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
/ An optional clause within an afterlinker,
- The subject clause, if present, recalls something just mentioned (the link subject)
and explicitly locates the text that mentioned it.
╶──╴‘re’╶── P ── pattern matcher ───▶
diagram, The form of a subject clause in an afterlinker.
- Absent a subject clause, the mention of the subject is located
implicitly as the head of the afterlinker’s parent.
subject mentions( afterlinker li )
/ A list in linear order of pattern matches, each locating a mention of the link subject;
or any empty list if the head of li’s parent is to be taken implicitly
as the sole mention.
if( li includes no subject clause )
return+ an empty list
return+ `parental head match( pattern matcher of li’s subject clause )`
: see `^*parental head match` @ `^^hierarchic relata$`i
─────────────────────
referential command
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
- The referential command of an afterlinker refers the reader to the object,
and determines the type of the afterlinker.
: re `type of the (afterlinker)` see `${same}` @ `^+fractal types$` :
Which in turn determines its interpretation.
·
┌── cf.+ ───┐
│ │
├─╴‘contra’─┤
│ │
├─╴‘e.g.’╶──┤
│ │
├─╴‘i.e.’╶──┤
│ │
├─╴‘join’╶──┤
╶──┤ ├───▶
├─╴‘NB’╶────┤
│ │
├─╴‘N.B.’╶──┤
│ │
├─╴‘pace’╶──┤
│ │
├─╴‘q.v.’╶──┤
│ │
├─╴‘sc.’╶───┤
│ │
├── see+ ───┤
│ │
└─╴‘viz.’╶──┘
: ad `q.v.` : Referential command `q.v.` is of limited use. It makes grammatical
sense only when a) the subject clause is absent, and b) the object clause
is either absent or comprises a fractal context locant (for example,
`q.v. @ foo.brec`).
cf.+
╶──╴‘cf.’╶──┬── S ──╴‘e.g.’╶──┬───▶
│ │
└─────────────────┘
see+
┌──╴‘also’╶──┐
╶──╴‘see’╶──┬── S ──┤ ├──┬───▶
│ └──╴‘e.g.’╶──┘ │
│ │
└───────────────────────┘
\ ‘See also’ at least has no abbreviated form.
\ https://english.stackexchange.com/q/491883/371457
───────────────
object clause
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
/ An optional clause within an afterlinker,
- The object clause, if present, explicitly locates or identifies the link object.
┌────── URI reference ───────┐
╶──┤ ├───▶
├────── fractum locant ──────┤
│ │
└── fractal context locant ──┘
: re `URI reference` see https://www.rfc-editor.org/rfc/rfc3986#section-4.1
diagram, The form of an object clause in an afterlinker.
- It happens that a URI reference and a fractum locant may have the same form.
- Yet an object clause in the form of a URI reference must unambiguously be taken
either as a URI reference or as a fractum locant, not both.
- The following method disambiguates the two cases.
: note : Always an author may use a `non-fractal` qualifier
to forestall a URI referent being interpreted as Breccia.
comprises a URI reference( an object clause c_o in the form of a URI reference )
/ Answers whether c_o is to be taken to comprise a URI reference
as opposed to a fractum locant.
deem+ u a URI reference
unless( c_o has just the form of a URI reference u )
throw+ not in the form of a URI reference: c_o
deem+ p the path component of u;
s a path segment
: re `(path component).+(path segment)`s see
https://www.rfc-editor.org/rfc/rfc3986#section-3.3
if( p ends with a path segment s )
/ It follows that p does not end with ‘/’.
if( s ends with ‘.brec’ )
/ Then take c_o to comprise a fractum locant.
return+ false
if( the referent of u is known or given to comprise Breccia )
/ Then take c_o to comprise a fractum locant.
return+ false
return+ true
- Absent an object clause, the object is located implicitly by the form
in which the subject was mentioned.
: see `^*/ No object clause is present.$` @ `^*object\( afterlinker li \)$`
object( afterlinker li )
/ Locates or identifies the object.
deem+ lo_f a fractum locant, m_0 the pattern matcher `^^${same}`ip
if( li includes an object clause )
deem+ c_o the object clause
if( c_o has just the form of a URI reference )
if( `comprises a URI reference( c_o )` )
return+ the referent of the URI reference
if( c_o includes a URI reference with a `non-fractal` qualifier )
return+ the referent of the URI reference
/ It falls to the caller or reader to determine what more, if anything,
the author intended by this atypical form of reference.
if( c_o comprises a fractal context locant )
+ Set lo_f to m_0 in space-delimited conjunction with the fractal context locant.
return+ a fractum, that of `locate fractum( li, lo_f )`
/ It happens c_o comprises a fractum locant.
+ Set lo_f to the fractum locant that constitutes c_o.
deem+ f a fractum, m a possible match, those of `locate fractum( li, lo_f )`
if( no m occured, or no capture group of m captured a text sequence )
return+ f
return+ a disjoint text sequence comprising all captures of m.
/ No object clause is present.
+ Set lo_f to m_0.
return+ a fractum, that of `locate fractum( li, lo_f )`
locate fractum( afterlinker li, fractum locant lo_f )
/ Returns the located fractum, together with any match that served to pinpoint it.
deem+ f a fractum, m a possible match,
those of `locate fractum( lo_f, fIgnore = parent of li )`
: ad `fIgnore = parent of li` : Exclude from the search area the head
of linker li’s parent, wherein the link subject is mentioned.
\ Else too often locant matchers formed on the pattern of the mention
\ — e.g. using `${same}` — will inadvertently match the mention.
if( f is privatized and local to li, and li is unprivatized )
throw+ malformed linker: li is unprivatized yet makes a local reference
to privatized fractum f
: N.B. `should be able.+remove.+privatized fracta.+without impairing.+integrity`
@ `^^privatizer$`i
/ To repair this, either privatize li, make its reference remote or non-fractal,
or deprivatize f.
return+ f and any m
─────────────────────────
interpolation variables
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
- The following interpolation variables are valid in the fractum-locant patterns
of an object clause.
${1}, ${2}, ${3}, … ${9}
/ Equates as follows.
deem+ v the present instance of this interpolation variable;
g the ordinal digit comprising the content of v;
li an afterlinker, namely the owning fractum of v;
mm the list of `subject mentions( li )`
if( mm contains no mention )
throw+ back reference to a subject-clause capture, but no subject clause
deem+ m the first mention of mm
if( m includes no capture g )
throw+ no such capture group in the subject clause
return+ the text sequence of capture g
${same}
/ Equates as follows.
deem+ li an afterlinker, namely the owning fractum of the present instance
of this interpolation variable;
mm the list of `subject mentions( li )`
if( mm contains a mention )
deem+ m the first mention
if( m includes a capture )
return+ a text sequence comprising all captured sequences of m,
in capture order, separated by spaces ‘ ’ (20)
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
return+ a copy of the whole text sequence of m modified thus:
⁃ Trimmed of leading and trailing whitespace
⁃ Any remaining sequences of whitespace each collapsed to a single space ‘ ’ (20)
⁃ Reconstituted, if the above has emptied it, as a single space
else if( the parent of li is a titled division )
: see `^*division titles\( divider` @ `^^division$`i
return+ the first titling label of the division title
: re `first titling label` cf. `where.+${same}.+might start`sp @ `^*\^\+` @
`^^pattern language$`i @ `^^regular-expression pattern matching$`i :
Compatible by design.
else( the parent of li is a file fractum or point )
return+ `parental head text(li)` modified thus:
: see `^*parental head text` @ `^^hierarchic relata$`i
⁃ Truncated to the portion prior to any comment carrier or indent blind
⁃ Trimmed of its perfect indent
⁃ Trimmed of any trailing whitespace
⁃ Any remaining sequences of whitespace each collapsed to a single space ‘ ’ (20)
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
━━━━━━━━━━━━━
Alarm point
─────────────
- A point wherein the bullet comprises ‘!!’ or ends with ‘!!’ and is not directly followed
by a no-break space (A0).
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
- Nominally it forms urgent matter for the attention of authors.
/ E.g. indicating a problem with the text.
- Its descriptor, if present, is largely free in form.
/ It may not start with a no-break space, however, as then the point would instead
be a plain point.
: see `^*. One purpose of placing a no-break space.+in this position` @ `^*bullet$`
━━━━━━━━━━━━━
Aside point
─────────────
- A point wherein the bullet comprises ‘/’ and is not directly followed by a no-break space (A0).
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
- Nominally it forms matter of less import than its place would otherwise suggest.
/ E.g. matter to which the reader should give less attention on a first reading.
- Its descriptor, if present, is largely free in form.
/ It may not start with a no-break space, however, as then the point would instead
be a plain point.
: see `^*. One purpose of placing a no-break space.+in this position` @ `^*bullet$`
━━━━━━━━━━━━━━━
Command point
───────────────
- A point wherein the bullet comprises ‘:’ and is not directly followed by a no-break space (A0).
: re `not directly followed by a no-break space` see
`^*. One purpose of placing a no-break space.+in this position` @ `^*bullet$`
- Its descriptor has this form:
╶── S ──┬──╴‘privately’╶─ S ──┬── command ──┬── P ──┬── appendage clause ──┬───▶
│ │ │ │ │
└─────────────────────┘ │ └──┬───────────────────┘
└──────────┘
\ S not P before the command, in order that parsers may reach the command and identify
\ the type of command point without having to navigate the formal complexity of P.
- The form of the command varies with the type of command point.
: re `type of (command point)` see `${same}` @ `^+fractal types$`
- The `privately` modifier, if present, is equivalent to putting a privatizer
on the command point.
appendage clause
- A clause of free-form, descriptive text appended to a command point.
appendage
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
┌─────╴◀────────┐
│ │
╶──╴‘:’╶──┴── P ── term ──┴─┬── P ──┬───▶
│ │
└───────┘
━━━━━━━━━━━━━━━━━
Comment carrier
─────────────────
- A carrier of commentary for the attention of authors, publishers or other atypical readers.
: cf. `^+Privatizer$`
- Each comment carrier is formed as either a comment appender or a comment block,
as shown in the diagrams that follow.
- In these diagrams, no commentary part begins or ends with a plain space character (20).
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
- Any such space at the leading or trailing edge is separate from the commentary proper.
comment appender
- A carrier of commentary subsequent to non-commentary on the same line.
commentary
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
┌─╴◀────┐ ┌────╴◀─────────┐
in-line non- ┊ │ │ │ │ end
-plain-space ╶── S ┊╶──┴─╴‘\’╶─┴─┬── S ──┴── character ──┴─┬─┬── S ──┬──╴ of ───▶
(non-20) ┊ │ │ │ │ line
└─────────────────────────┘ └───────┘
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
: re `(end).+(of) ─.+(line)\R`s see `^*end of line$`
diagram, The form of a comment appender.
comment block
- A comment carrier that extends over a sequence of (one or more) whole lines.
commentary
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
┌─╴◀────┐ ┌────╴◀─────────┐
start ┊ │ │ │ │ end
of ┊╶──┬── S ──┬─┴─╴‘\’╶─┴─┬── S ──┴── character ──┴─┬─┬── S ──┬──╴ of ───▶
line ┊ │ │ │ │ │ │ line
└───────┘ └─────────────────────────┘ └───────┘
: re `(end).+(of) ─.+(line)\R`s see
diagram, The form of each line of a comment block.
- The commentary of a comment block may include one or more no-break spaces (A0).
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
/ An author may, for example, comment out an indent blind, or a point whose bullet
contains a no-break space, without thereby introducing an error.
comment-block label
/ A type of commentary. Part of a comment block.
- Commentary delimited by two or more backslashes in a line of a comment block.
comment-block label
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
┌─╴◀────┐ ┌────╴◀─────────┐
start │ │ ┊ │ │ ┊ end
of ╶──┬── S ──┬─╴‘\’╶─┴─╴‘\’╶─┴── S ┊╶──┴── character ──┴───▶ ┊╶──┬── S ──┬──╴ of
line │ │ ┊ ┊ │ │ line
└───────┘ └───────┘
: re `(end)$.+(of)$.+(line)$`s see
━━━━━━━━━━
Division
──────────
- A body fractum with a head in the form of a divider.
divider
- The head of a division.
- It comprises all contiguous divider segments.
│
│
├─────┐
╵ │
divider ▲
segment │
╷ │
├─────┘
│
│
▼
/ It follows that sibling dividers cannot be made contiguous;
rather their segments would coalesce to comprise one divider.
divider segment
/ Part of a divider.
- It starts with a perfectly indented divider drawing character.
┌───╴◀────────┐ ┊
start ┊ perfect divider │ │ ┊ divider segment,
of ┊╶─── indent ──╴ drawing ──┬─┴─ character ─┴─┬───▶ ┊ non-divider fractum,
line ┊ character │ │ ┊ or end of file
└─────────────────┘ ┊
: re `(perfect).+\R.+(indent)` see @ `^+Separation$`
: re `(divider).+\R.+(drawing).+\R.+(character)` see
- Outside of comment carriers and indent blinds, characters between the leading,
divider drawing character and the end boundary of the segment (rightmost in diagram)
are unconstrained in form.
divider drawing character
- A character in the Unicode range 2500-259F.
: re `2500-259F` see http://unicode.org/charts/PDF/U2500.pdf
: re `2500-259F` see http://unicode.org/charts/PDF/U2580.pdf
division label
/ Part of a divider segment.
- A sequence of non-divider-drawing characters within a line of a divider segment,
exclusive of any
⁃ comment carrier,
⁃ indent blind or
⁃ leading or trailing plain space characters (20).
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
division title
- A division title comprises all division labels of contiguous lines (one or more in number)
each of which precedes any divider drawing character of the same line.
/ Consider for example this divider:
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
This is a division title, ┊ This is not
and it includes this ┊
┄┄┄┄┄┄┄┄┄┄┄┄┄ This is not ┄╯
This is a 2nd division title
/ Assume the horizontal lines above (‘┄┄┄’) are perfectly indented.
: re `perfectly indented` see `^*perfect indent$` @ `^+Separation$`
/ Calling `division titles( example divider )` would yield:
⇒ ‘This is a division title, and it includes this’
‘This is a 2nd division title’
- Presenters may give greater prominence to division titles, e.g. showing them in bold face.
division titles( divider `d` )
/ A list in linear order of character strings, each to be taken as a title
of the division headed by `d`.
deem+ `tt` a string list, intitally empty
/ `tt` The list of title strings.
deem+ `b` and `bLast` division labels, `bString` a string, `t` a string
/ `t` The title being assembled, yet to be appended to `tt`.
/ `bLast` The division label last contributed to `t`, if any.
for( each division label `b` of divider `d` )
if( `b` leads the line on which it occurs, discounting plain spaces (20) )
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
- Then `b` is a titling label, meaning it contributes to a title.
+ Set `bString` to the string of `b`.
+ Collapse in `bString` each sequence of plain spaces to a single plain space.
if( `bLast` is unset )
- Then `b` starts the first title.
+ Set `t` to `bString`.
else if( `b` occurs on the line succeeding `bLast` )
/ Note that `bLast` must occupy a single line.
: see `a sequence.+within a line`i @ `^^division label$`i
- Then `b` appends to the title (`t`) made by its predecessor.
+ Set `t` to the concatenation of `t` + space character + `bString`.
else( `t` is fully assembled and `b` starts a new title )
+ Append to `tt` a copy of `t`.
+ Set `t` to `bString`.
+ Set `bLast` to `b`.
if( `t` is set )
- Then `d` has a titling label and final title assembly `t`.
+ Append to `tt` a copy of `t`.
return+ `tt`
─────────────────
pseudo-division
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
- A pseudo-division is a group of siblings wherein only the first is a true division
(often a headless one, a bare divider), the remainder being of other fractal types.
- Normally a sibling *successor* to a division is itself a division.
- Where it is not, it may appear (owing to its placement under the same divider)
to be *part* of that division.
- Such an apparently *extended* division is called a pseudo-division.
/ The appearance of extension is false because the successors lie ‘under’
the same divider merely in terms of linear order, not hierarchy.
- Pseudo-divisions are a linear form of partition,
as opposed to the hierarchic form of true divisions.
/ The whole of a pseudo-division may be transformed to a true division
by indenting all but the first sibling into the *body* of the first.
━━━━━━━━━━━━━━
File fractum
──────────────
- The largest formal unit of Breccian composition, forming the content of a file.
- It comprises a head formed as a file descriptor
and/or a body formed as a sequence of body fracta.
start of file
┄┄┄┄┄┄┄┄┄┄┄┄┄
│
│
├──────┐
╵ │ ╮
file │ ┊
descriptor │ ┊ head
╷ │ ┊
┌────┤ │ ╯
│ ├──────┘
│ │
│ ├────┐ ╮
│ ╵ │ ┊
│ body ▲ ┊
│ fractum │ ┊ body
│ ╷ │ ┊
│ ├────┘ ┊
└────┤ ╯
│
│
▼
┄┄┄┄┄┄┄┄┄┄┄┄┄
end of file
: re `(file).*(descriptor)`s see
: re `(body).*(fractum)`s see `${same}` @ `^+fractal types$`
diagram, The form of a file fractum.
- Either the head or the body may be absent, not both.
/ Absence of both implies no file fractum at all, thus an empty file.
- The head is absent (and a body present) if the first line of the file
is perfectly indented and not part of a comment block.
: re `perfectly indented` see `^*perfect indent$` @ `^+Separation$`
─────────────────
file descriptor
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
/ Aka ‘file head’.
: cf. `^*point descriptor$`
- The head of a file fractum.
- It is largely free in form, constrained only by its foregap (F) and end boundary.
┌───────╴◀─────────┐
start ┊ │ │ ┊ end boundary
of ┊╶── F ──┬─┴── term ──┬── P ──┴─┬───▶ ┊ of head
file ┊ │ │ │ ┊
│ └──┬──────┘
└───────────────┘
: re `(end boundary)\R.+(of head)`
see `^*- Always its end boundary` @ `^*head$` @ `^+Fractum$`
diagram, The form of a file descriptor.
- By definition, the first term will not be perfectly indented.
: re `perfectly indented` see `^*perfect indent$` @ `^+Separation$`
/ Here a perfect indent would instead form the start of a body, not of a head.
────────────
file title
┈┈┈┈┈┈┈┈┈┈┈┈
- The file title, if any, is determined by the first fractal head in linear order
whose titling extract is neither null nor empty.
- The file title is that extract.
titling extract( fractal head `h` )
if( `h` is a divider )
return+ the first division title of `h`, or null if there is none
: re `division title` see `^^${same}$`i @ `^^division$`i
else( `h` is a file head or point head )
return+ `h` modified thus:
⁃ Truncated to the portion prior to any indent blind
⁃ Divorced of all comment carriers
⁃ Trimmed of leading and trailing plain whitespace
⁃ Any remaining sequences of plain whitespace each collapsed
to a single plain space ‘ ’ (20)
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
━━━━━━━━━
Fractum
─────────
- A fractum is the basic formal unit of Breccian composition, recursion and order.
- It divides formally into two parts: a head and a body.
│
│
╵
· · · · ╮
· · ┊
· ? · ┊ head
· · ┊
· · · · ╯
╷
│
┌────┤ ╮
│ ├────┐ ┊
│ ╵ │ ┊
│ body ▲ ┊ body
│ fractum │ ┊
│ ╷ │ ┊
│ ├────┘ ┊
└────┤ ╯
│
│
▼
: re `(body).*(fractum)`s see `${same}` @ `^+fractal types$`
diagram, The abstract form of a fractum.
head
- The part of a fractum exclusive of its children.
- Its form (shown abstractly in the diagram) varies according to fractal type.
- Never does the head of a body fractum, however, begin with a newline.
/ Only a file head may begin with a newline.
- Every newline belongs to the same fractal head as the character that precedes it;
or, if no character precedes it, then it belongs to the file head.
- Always its end boundary (not fully shown) comprises one of:
• the head successor
- The head successor is the fractum succeeding the head in linear order.
- In terms relative to the head’s own fractum f, the head successor is the first
applicable of:
⁃ The first child of f.
/ In its body, that is.
⁃ The next sibling of f.
⁃ The next sibling of the nearest ancestor of f.
- Always in this case the final character sequence of the head
comprises one or more newlines.
/ In this case, even a point head that nominally omits its descriptor
must in fact have a descriptor comprising one or more newlines.
• the end of the file
body
- The part of a fractum comprising its children alone; a sequence of sibling body fracta.
- A body is always optional: regardless of fractal type, it may be omitted.
term
- Substansive content of a fractal head outside of a separator.
- Formally a sequence of non-whitespace characters that does not comprise
a sequence of backslashes ‘\’.
/ Here a sequence of backslashes ‘\’ would instead delimit a comment carrier;
so forming part of a separator (F or P), not of a term.
───────────────
fractal types
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
◆ file fractum
◇ body fractum
◆ division
◇ point
◆ alarm point
◆ aside point
◇ command point
◇ afterlinker
◆ jointer
◆ pointer
◆ note carrier
◆ privatizer
◆ plain point †
◆ task point
legend
◇ abstract type
◆ concrete type
† informal type
───────────────────
hierarchic relata
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
: privately cf. `comparative genealogical terms$` @ non-fractal
http://reluk.ca/project/proto-wayic/origins/doc.task
ancestor, of a body fractum f_b
- The parent of f_b, or an ancestor of the parent.
/ No file fractum has an ancestor, body fracta alone have ancestors.
parent, of a body fractum f_b
- f_b’s nearest fractal predecessor of less indent, if any, otherwise the file fractum.
/ No file fractum has a parent, body fracta alone have parents.
sibling, of a body fractum f_b
- Another body fractum of the same parent as f_b.
/ No file fractum has a sibling, body fracta alone may have siblings.
/ No file fractum is a sibling; all siblings are body fracta.
child, of a fractum f
- One for whom f is parent.
/ No file fractum is a child; all children are body fracta, and vice versa.
descendant, of a fractum f
- A child of f, or a descendant of the child.
/ No file fractum is a descendant; all descendants are body fracta, and vice versa.
parental head text( fractum f )
/ The text sequence of the head of the parent of f.
deem+ p the parent of f
if( p is headless )
/ It happens p is a headless file fractum.
throw+ misplaced back reference, no parent head to refer to
return+ the text sequence of the head of p
parental head match( pattern matcher pm )
/ A list in linear order of the matches of pm within the head
of the parent of pm’s owning fractum.
deem+ f the owning fractum of pm;
h a text sequence, that of `parental head text(f)` trimmed of its perfect indent;
mm a list of matches, intitally empty;
m a match
for( each match m of pm against h )
if( m is an empty text sequence )
throw+ incomplete back reference, pm matches an empty text sequence
if( any capture group of pm fails in m to capture a non-empty text sequence )
throw+ incomplete back reference, this group captures nothing in the parent head
+ Append m to mm.
if( mm is empty )
throw+ broken back reference, no such text pm in parent head
return+ mm
───────────────
linear relata
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
predecessor, of a fractum or character x
- Another that precedes x in linear order.
/ (in the definite sense, e.g. ‘the predecessor’)
The immediate predecessor of x.
successor, of a fractum or character x
- Another that follows x in linear order.
/ (in the definite sense, e.g. ‘the successor’)
The immediate successor of x.
━━━━━━━━━━━━━━━━
Fractum locant
────────────────
/ Part of an associative or other reference.
- A fractum locant locates a fractum (typical case) or a non-fractal resource (atypical).
fractal
context locant
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
pattern
┌── matcher ──┬── P ─╴‘@’╶─ P ── fractum ───▶
│ │ locant
╶────┤ └───▶
╭ │ ╮
┊ └─┬──╴‘non-fractal’╶── P ──┬─── URI ────▶ ┊ file locant
┊ │ │ reference ┊
╰ └────────────────────────┘ ╯
: re `(pattern).*(matcher)`s see
: re `(fractum).*(locant)`s see
: re `(URI).*(reference)`s see https://www.rfc-editor.org/rfc/rfc3986#section-4.1
diagram, The form of a fractum locant.
- The `non-fractal` qualifier, if present, warns that the referent of the URI reference
does not comprise Breccia.
- Readers and processors should not, in this case, expect to actually locate a fractum.
: re `processors.+actually (locate a fractum)` see e.g. `attempt to ${same}` @
`^^locate fractum\(.+lo_f.+fIgnore.+\)$`s
locate fractum( fractum locant lo_f,
any fractum fIgnore whose head to exclude from the search area )
/ Returns the located fractum, together with any match that served to pinpoint it.
deem+ f_0 a fractum
if( lo_f includes a file locant )
if( a `non-fractal` qualifier is present )
throw+ attempt to locate a fractum in a referent marked ‘non-fractal’
if( no referent can be resolved from the URI reference )
throw+ unable to resolve URI reference
if( the resolved referent contains no file fractum )
throw+ non-Breccian URI referent
+ Set f_0 to the file fractum of the resolved referent.
else
+ Set f_0 to the file fractum in which lo_f is contained.
deem+ p a pattern matcher, m and m_0 matches
if( lo_f includes a pattern matcher )
+ Set p to its final pattern matcher.
while( p is set )
for( each match m of p against the body of f_0 )
deem+ f the fractum in whose head m starts
if( end boundary(m) exceeds end boundary(head of f) )
/ Then match m extends across multiple heads. Ignore it.
\ Else matchers with dot-all modifier `s` would tend to match too broadly.
continue+ `for`
if( p is the first pattern matcher of lo_f )
if( fIgnore is set and equals f )
/ Then ignore this match.
continue+ `for`
if( lo_f lies within the head of f )
/ Then ignore this match. Fractum locants do not locate the fracta
in whose heads they are contained.
\ Else too often their matchers would match themselves by accident.
continue+ `for`
if( m_0 is unset )
+ Set m_0 to m.
+ Set f_0 to f.
else
if( f_0 equals f )
/ Then ignore this match. It is a further match in the same head,
and the first match takes precedence.
continue+ `for`
throw+ ambiguous reference, p matches multiple fractal heads
/ Such ambiguity is disallowed. \ Else pattern matchers that fail to match
\ their intended targets would be too liable to match elsewhere
\ and thus fail silently.
if( m_0 is unset )
throw+ broken reference, pattern of p not found
if( pattern matcher p has a predecessor in lo_f )
+ Set p to the predecessor.
+ Unset m_0.
else
+ Unset p.
return+ f_0 and any m_0
━━━━━━━━━━━━━━
Indent blind
──────────────
- A sequence of lines whose first non-plain-space character (non-20) is a no-break space (A0).
┌───╴◀────────┐
start ┊ │ │ ┌─── end of line ───┐
of ┊╶──┬── S ──┬── A0 ──┬─┴─ character ─┴─┬──┤ ├───▶
line ┊ │ │ │ │ └── S ── comment ───┘
└───────┘ └─────────────────┘ appender
: re `20` see http://unicode.org/charts/PDF/U0000.pdf
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
: re `(comment).+\R.+(appender)` see
diagram, The form of each line in an indent blind. This diagram
itself is an example of a blind comprising several such lines.
- By definition, no line of an indent blind can be perfectly indented, regardless of its S width.
: re `perfectly indented` see `^*perfect indent$` @ `^+Separation$`
- Therefore no indent blind ever interrupts the fractal head in which it occurs;
always the head continues through the blind.
━━━━━━━━━
Jointer
─────────
- An afterlinker with a referential command of `join`.
: cf. `^+Pointer$`
- In effect, it may stand for the fractal body of its object.
- Each parent of the jointer gains for a subjoint child (which is not an actual child)
each child of the object fractum that does not duplicate a pre-existing child.
- Here the duplication test ignores differences in whitespacing and comment carriage.
- If the object fractum itself has a jointer as its child,
then the effect applies recursively.
- Any subject clause in a jointer locates the subject in particular as the rationale
for writing the jointer into the text.
━━━━━━━━━━━━━━
Note carrier
──────────────
- A note carrier is used to place a note.
- It is a type of command point, and its command has this form:
preposition
╭┄┄┄┄┄┄┄┄┄┄┄┄╮
┌──╴‘ad’╶──┐ ┌────────────────────┐
│ │ │ │
┌──┴──╴‘on’╶──┴── P ── pattern matcher ──┴── P ──┬──╴‘note’╶──┴───▶
╶──┤ │
└────────────────────────────────────────────────┘ ╰┄┄┄┄┄┄╯
label
╰┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╯
purview clause
diagram, The form of the command in a note carrier.
- The note is carried in the appendage of the command point.
- The purview clause, if present, locates within the carrier parent’s head
the text to which the note pertains, namely its purview.
- Absent a purview clause, the purview is located implicitly
as the carrier parent’s head in toto.
purview( note carrier c )
/ A list in linear order of pattern matches locating the text sequences to which c’s note
pertains, or any empty list if the note pertains implicitly to the head of c’s parent.
if( c includes no purview clause )
return+ an empty list
return+ `parental head match( pattern matcher of c’s purview clause )`
: see `^*parental head match` @ `^^hierarchic relata$`i
━━━━━━━━━━━━━
Plain point
─────────────
- A catch-all designation for points of no defined subtype.
: re `defined subtype` see `^*◇ point` @ `^+fractal types$`
- A plain point is largely free in form.
━━━━━━━
Point
───────
- A body fractum with a head in this form:
start ┊ perfect point ┊ end boundary
of ┊╶─── indent ─── bullet ──┬── descriptor ──┬───▶ ┊ of head
line ┊ │ │ ┊
└────────────────┘
: re `(perfect).+\R.+(indent)` see `^*perfect indent$` @ `^+Separation$`
: re `(point).*(descriptor)`s see
: re `(end boundary)\R.+(of head)`
see `^*- Always its end boundary` @ `^*head$` @ `^+Fractum$`
diagram, The form of a point head.
bullet
- The bullet of a point head is defined by its leading and trailing edges
as shown in the diagrams below.
non-backslash, non-whitespace,
perfect ┊ ┌─────╴ non-divider-drawing character ────────┐
indent ┊╶──┤ ├───▶
┊ └──┬─╴‘\’╶─┬──╴ non-backslash, non-newline, ──┘
│ │ non-plain-space character
└─╴◀────┘
: re `(perfect).+\R.+(indent)` see `^*perfect indent$` @ `^+Separation$`
diagram, The form of a bullet’s leading edge.
- Between the edges, any non-alphanumeric, non-whitespace character may be followed
by a single no-break space (A0).
/ Authors may use such a no-break space in lieu of a plain space in order to avoid
the formation of a trailing edge that would prematurely terminate the bullet.
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
- The two edge diagrams (above and below) are not mutually exclusive,
their bullet characters may overlap.
/ The bullet may, for example, comprise a single character that alone occupies
both the leading and trailing edge.
·
┊
┌───▶ ┊╶─── end of line
non-alphanumeric │ ┊
┌──╴ non-whitespace ╶──┼───▶ ┊╶──╴‘ ’
│ character │ ┊ comment
╶──┤ └───▶ ┊╶── A0 ──┐ ┌───▶ appender
│ alphanumeric ┊ │ │
└──── character ────────▶ ┊╶────────┴───┬── S ──┴─┬───▶ end of line
┊ │ │
└─────────┘
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
: re `(comment)$.+(appender)$`s see
diagram, The form of a bullet’s trailing edge. The bullet
itself includes only parts to the left of the dashed line.
/ As the diagram shows, no bullet ends with a space character, whether plain or no-break.
Rather any space character at the trailing edge is separate from the bullet proper.
/ One purpose of placing a no-break space (A0) in this position is to defeat the formation
of a special bullet (alarm, aside, command or task bullet) or comment delimiter that
otherwise would occur. The present text contains examples of that usage.
: re `(task bullet).*(example)`s see `^*see\+\N{U+A0}$` @ `^+referential command$`
: re `(comment delimiter).*(example)`s see `^*\\\N{U+A0}$` @ `^+pattern language$` @
`^+Regular-expression pattern matching$`
point descriptor
: cf. `^+file descriptor$`
- Descriptive text in the head of a point.
- It is largely free in form, constrained only by its end boundary.
┌───────╴◀─────────┐
┊ ┌───────────┐ │ │ ┊ end boundary
bullet ┊╶──┤ ├──┴── P ──┬── term ──┴─┬───▶ ┊ of head
┊ └─── A0 ──┬─┘ │ │ ┊
│ └─┬──────────┘
└──────────────┘
: re `(end boundary)\R.+(of head)`
see `^*- Always its end boundary` @ `^*head$` @ `^+Fractum$`
: re `A0` see http://unicode.org/charts/PDF/U0080.pdf
diagram, The form of a point descriptor.
/ The option of a leading no-break space (A0) occurs only for a bullet ending with
a non-alphanumeric, non-whitespace character,
- Point descriptors of particular types may be further constrained.
: re `particular types` see `^*◇ point` @ `^+fractal types$`
: e.g. `^+Command point$`
━━━━━━━━━
Pointer
─────────
- An afterlinker whose referential command is other than ‘join’.
: cf. `^+Jointer$`
━━━━━━━━━━━━
Privatizer
────────────
- A privatizer privatizes its parent, thereby marking the parent (both head and body)
as pertaining soley to the author, or authors.