-
Notifications
You must be signed in to change notification settings - Fork 2
/
syntax_diagrams.tcl
2350 lines (2050 loc) · 58.1 KB
/
syntax_diagrams.tcl
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
#!/usr/bin/wish
#
# Syntax diagram generator for Modula-2 BSK, status July 31, 2020
#
# This script is derived from the SQLite project's bubble-generator script.
# It is quite possibly the only such tool that can wrap-around diagrams so
# that they do not go off-page when inserting them into an ordinary A4 or
# US letter document. Thanks to the folks at the SQLite project for making
# their script available to the public.
#
# The present version of the script was cleaned up, enhanced, documented
# and modified by B.Kowarsch to become accessible to those unfamiliar with
# TCL/TK, and in particular to generate syntax diagrams for Modula-2 (R10).
#
# Ideally the design would have been changed such that the script can read
# grammars from a text file in EBNF notation. Ideally, this script would
# have been rewritten in a more readable language, Modula-2 for instance.
# Due to time constraints, these tasks had to be left for some other time
# or for somebody else to do. In the meantime the documentation embedded
# herein should suffice even for those unfamiliar with TCL to modify the
# script to generate diagrams for their own grammars.
#
# THIS SOFTWARE COMES WITHOUT ANY WARRANTY OF ANY KIND. USE IS STRICTLY AT
# THE RISK OF THE USER. PERSONS WHO HAVE A LEGAL RIGHT TO SUE AUTHORS OF
# NO-WARRANTY-FREE-OF-CHARGE OPEN SOURCE SOFTWARE ARE SPECIFICALLY *NOT*
# GIVEN ANY PERMISSION TO USE THIS SOFTWARE. THE BOTTOM LINE IS : YOU MAY
# USE THIS SOFTWARE WITHOUT PERMISSION ANYWAY, BUT YOU *CANNOT* SUE THE
# AUTHORS FOR DAMAGES BECAUSE IF YOUR GOVERNMENT GRANTS YOU SUCH RIGHTS
# THEN YOU DID *NOT* HAVE PERMISSION TO USE THIS SOFTWARE TO BEGIN WITH.
# THUS, NO MATTER WHAT THE CIRCUMSTANCES, THE RISK IS ALWAYS YOURS ALONE.
#
# Top-level displays
#
toplevel .bb
canvas .c -bg white
pack .c -side top -fill both -expand 1
wm withdraw .
#
# ===========================================================================
# D O C U M E N T A T I O N
# ===========================================================================
#
# The grammar is encoded as a nested TCL list structure of the general form:
#
# { production1 { ... } production2 { ... } ... }
#
# Production rules can be translated from (ANTLR) EBNF to TCL list items as
# follows:
#
# Simple term
#
# production : term ;
# => production { line term }
#
# Sequence and group
#
# production : term1 term2 ;
# => production { line term1 term2 }
#
# Alternative
#
# production : term1 | term2 ;
# => production { or term1 term2 }
#
# Optional term
#
# production : term? ;
# => production { opt term }
# => production { optx term }
#
# opt renders the bypass line in the main path
# optx renders the term in the main path
#
# Terms that occur one or more times
#
# production : term+ ;
# => production { loop { line term } {} }
#
# Terms that occur zero or more times
#
# production : term* ;
# => production { loop {} { nil term } }
#
# Causing diagrams to wrap-around
#
# production : term1 /* wrap here */ term2 /* wrap here */ term3 ;
# => production { stack {line term1} {line term2} {line term3} }
#
# Rendering of terminals, non-terminals and tokens
#
# Symbols are rendered according to their category:
# (1) reserved words, names in all uppercase letters
# (2) reserved identifiers, names in all uppercase letters preceded by /
# (3) other terminals, mixed case names with a leading uppercase letter
# (4) non-terminals, mixed case names with a leading lowercase letter
# (5) single letter tokens, a single letter or a range eg. a..z / A..Z
# (6) special symbol tokens, any other characters or character sequences
#
# Special names for tokens that TCL cannot handle verbatim
#
# BACKSLASH is rendered as \
# SINGLE_QUOTE is rendered as '
# DOUBLE_QUOTE is rendered as "
# DOUBLE_DQUOTE is rendered as ""
# LEFT_BRACE is rendered as {
# RIGHT_BRACE is rendered as }
#
# Rendering parameters
#
# RES_WORD_FONT - font/size/style used to render reserved words
# RES_IDENT_FONT - font/size/style used to render reserved identifiers
# TERM_FONT - font/size/style used to render any other terminals
# NON_TERM_FONT - font/size/style used to render non-terminals
# TOKEN_FONT - font/size/style used to render tokens
# RADIUS - turn radius for arcs
# HSEP - horizontal separation
# VSEP - vertical separation
# LWIDTH -line width
#
# Pre-requisites
#
# TCL and TK need to be installed
#
# Running the script
#
# the most fool-proof method to run this script is to call the wish shell
# with the name of the script as an argument:
#
# $ wish modula2_syntax_diagrams.tcl
#
# in the window that appears, click on the top button "Draw All Diagrams"
#
# Diagrams will be written into postscript files in the working directory
#
# ===========================================================================
#
# ===========================================================================
# Modula-2 grammar
# ===========================================================================
# To reuse this diagram generator for other languages, replace the following
# section with a definition of the grammar of the target language.
#
# Do NOT add comments or blank lines within a production rule's definition!
#
# ---------------------------------------------------------------------------
# Non-Terminal Symbols
# ---------------------------------------------------------------------------
#
set non_terminals {}
# (1) Compilation Unit
lappend non_terminals compilationUnit {
or
definitionModule
implementationModule
programModule
}
# ------------------------
# Definition Module Syntax
# ------------------------
# (2) Definition Module
lappend non_terminals definitionModule {
stack
{line DEFINITION MODULE moduleIdent ;}
{line {loop nil import} {loop nil definition} END moduleIdent .}
}
# (2.1) Module Identifier
lappend non_terminals moduleIdent {
line StdIdent
}
# (3) Import
lappend non_terminals import {
line IMPORT {loop {line libIdent {optx reExport}} ,} ;
}
# (3.1) Library Identifier
lappend non_terminals libIdent {
line StdIdent
}
# (3.2) Re-Export Suffix
lappend non_terminals reExport {
line +
}
# (4) omitted
# (5) Definition
lappend non_terminals definition {
line {
or
{line CONST {loop {line constDefinition ;} nil} }
{line TYPE {loop {line typeDefinition ;} nil} }
{line VAR {loop {line identList : typeIdent ;} nil} }
{line procedureHeader ;}
{line toDoList ;}
}
}
# (6) Constant Definition
lappend non_terminals constDefinition {
or constantBinding constDeclaration
}
# (6.1) Constant Binding
lappend non_terminals constantBinding {
line [ {or /COLLATION /TLIMIT} ] = constExpression
}
# (6.2) Constant Declaration
lappend non_terminals constDeclaration {
line ident {optx : typeIdent} = constExpression
}
# (6.3) Constant Expression
lappend non_terminals constExpression {
line expression
}
# (7) Identifier
lappend non_terminals ident {
line StdIdent
}
# (8) Type Definition
lappend non_terminals typeDefinition {
line ident = {
or
aliasType
derivedType
subrangeType
enumType
setType
arrayType
recordType
pointerType
opaqueType
procedureType
}
}
# (9) Alias Type
lappend non_terminals aliasType {
line ALIAS OF typeIdent
}
# (9.1) Type Identifier
lappend non_terminals typeIdent {
line qualident
}
# (9.2) Qualified Identifier
lappend non_terminals qualident {
or StdIdent Qualident
}
# (10) Derived Type
lappend non_terminals derivedType {
line typeIdent
}
# (11) Subrange Type
lappend non_terminals subrangeType {
line constRange OF countableType
}
# (11.1) Range Expression
lappend non_terminals constRange {
line [ lowerBound .. upperBound ]
}
# (11.2) Lower Bound
lappend non_terminals lowerBound {
line constExpression
}
# (11.3) Upper Bound
lappend non_terminals upperBound {
line constExpression
}
# (11.4) Countable Type
lappend non_terminals countableType {
line typeIdent
}
# (12) Enumeration Type
lappend non_terminals enumType {
line ( {optx + enumTypeToExtend ,} identList )
}
# (12.1) Enumeration Type To Extend
lappend non_terminals enumTypeToExtend {
line enumTypeIdent
}
# (12.2) Enumeration Type Identifier
lappend non_terminals enumTypeIdent {
line typeIdent
}
# (12.3) Identifier List
lappend non_terminals identList {
loop StdIdent ,
}
# (13) Set Type
lappend non_terminals setType {
line SET OF enumTypeIdent
}
# (14) Array Type
lappend non_terminals arrayType {
line ARRAY valueCount OF typeIdent
}
# (14.1) Value Count
lappend non_terminals valueCount {
line constExpression
}
# (15) Record Type
lappend non_terminals recordType {
line RECORD {optx ( recTypeToExtend )} {loop fieldList ;} END
}
# (15.1) Record Type To Extend
lappend non_terminals recTypeToExtend {
or /NIL typeIdent
}
# (15.2) Field List
lappend non_terminals fieldList {
line identList : {
or
typeIdent
arrayType
subrangeType
procedureType
}
}
# (16) Pointer Type
lappend non_terminals pointerType {
line POINTER TO typeIdent
}
# (17) Opaque Type
lappend non_terminals opaqueType {
line OPAQUE {or {line [ allocSize ]} POINTER}
}
# (17.1) Allocation Size
lappend non_terminals allocSize {
line constExpression
}
# (18) Procedure Type
lappend non_terminals procedureType {
line PROCEDURE {optx ( {loop formalType ;} )} {optx : returnedType}
}
# (18.1) Formal Type
lappend non_terminals formalType {
line {or CONST VAR nil} nonAttrFormalType
}
# (18.2) Non-Attributed Formal Type
lappend non_terminals nonAttrFormalType {
or simpleFormalType castingFormalType variadicFormalType
}
# (18.3) Returned Type
lappend non_terminals returnedType {
line typeIdent
}
# (19) Simple Formal Type
lappend non_terminals simpleFormalType {
line {optx ARRAY OF} typeIdent
}
# (20) Casting Formal Type
lappend non_terminals castingFormalType {
line /CAST {or OCTETSEQ /ADDRESS}
}
# (21) Variadic Formal Type
lappend non_terminals variadicFormalType {
line ARGLIST OF simpleFormalType
}
# (22) Procedure Header
lappend non_terminals procedureHeader {
line PROCEDURE {optx [ bindingSpecifier ]} procedureSignature
}
# (22.1) Binding Specifier
lappend non_terminals bindingSpecifier {
or
{line NEW {or argListFlag capacityFlag nil}}
RETAIN
RELEASE
{line READ {optx allocFlag}}
{line WRITE {optx formatFlag}}
{line bindableIdent}
}
# (22.2) Argument List Flag
lappend non_terminals argListFlag {
line +
}
# (22.3) Capacity Flag
lappend non_terminals capacityFlag {
line *
}
# (22.4) Allocation Flag
lappend non_terminals allocFlag {
line *
}
# (22.5) Format Flag
lappend non_terminals formatFlag {
line OCTOTHORPE
}
# (22.6) Bindable Ident
lappend non_terminals bindableIdent {
or Pervasive Primitive
}
# (23) Procedure Signature
lappend non_terminals procedureSignature {
line ident {optx ( {loop formalParams ;} )} {optx : returnedType}
}
# (24) Formal Parameters
lappend non_terminals formalParams {
line {or CONST VAR nil} identList : nonAttrFormalType
}
# ----------------------------------------
# Implementation and Program Module Syntax
# ----------------------------------------
# (30) Program Module
lappend non_terminals programModule {
stack
{line MODULE moduleIdent ;}
{line {loop nil privateImport} block moduleIdent .}
}
# (30.1) Private Import
lappend non_terminals privateImport {
line IMPORT {loop libIdent ,} ;
}
# (31) Block
lappend non_terminals block {
line {loop nil declaration}
BEGIN statementSequence END
}
# (32) Implementation Module
lappend non_terminals implementationModule {
stack
{line IMPLEMENTATION MODULE moduleIdent ;}
{line {loop nil privateImport} possiblyEmptyBlock moduleIdent .}
}
# (32.1) Possibly Empty Block
lappend non_terminals possiblyEmptyBlock {
line {loop nil declaration} {optx BEGIN statementSequence} END
}
# (33) Declaration
lappend non_terminals declaration {
line {
or
{line CONST {loop {line constDeclaration ;} nil}}
{line TYPE {loop {line typeDeclaration ;} nil}}
{line VAR {loop {line varDeclaration ;} nil}}
{line procedureHeader ; block ident ;}
{line aliasDeclaration ;}
{line toDoList ;}
}
}
# (34) Type Declaration
lappend non_terminals typeDeclaration {
line ident = {
or
aliasType
derivedType
subrangeType
enumType
setType
arrayType
recordType
octetSeqType
privatePointerType
procedureType
}
}
# (34.1) Octet Sequence Type
lappend non_terminals octetSeqType {
line OCTETSEQ [ valueCount ]
}
# (34.2) Private Pointer Type
lappend non_terminals privatePointerType {
line POINTER TO {or determinateTarget indeterminateTarget}
}
# (34.3) Determinate Target
lappend non_terminals determinateTarget {
line typeIdent
}
# (34.4) Indeterminate Target
lappend non_terminals indeterminateTarget {
line RECORD {optx {loop {line fieldList ;}}} indeterminateField END
}
# (34.5) Indeterminate Field Declaration
lappend non_terminals indeterminateField {
line + ident : ARRAY capacityField OF typeIdent
}
# (34.6) Capacity Field
lappend non_terminals capacityField {
line ident
}
# (35) Variable Declaration
lappend non_terminals varDeclaration {
line fieldList
}
# (36) Alias Declaration
lappend non_terminals aliasDeclaration {
line UNQUALIFIED {loop nameSelector ,}
}
# (36.1) Name Selector
lappend non_terminals nameSelector {
line qualident {optx wildcard}
}
# (36.2) Wildcard
lappend non_terminals wildcard {
line .*
}
# (37) Statement Sequence
lappend non_terminals statementSequence {
loop statement ;
}
# (38) Statement
lappend non_terminals statement {
line {
or
memMgtOperation
updateOrProcCall
returnStatement
copyStatement
readStatement
writeStatement
ifStatement
caseStatement
loopStatement
whileStatement
repeatStatement
forStatement
toDoList
EXIT
NOP
}
}
# (39) Memory Management Operation
lappend non_terminals memMgtOperation {
or
newStatement
retainStatement
releaseStatement
}
# (39.1) NEW Statement
lappend non_terminals newStatement {
line NEW designator {
or
{line := expression}
{line /CAPACITY expression}
nil
}
}
# (39.2) RETAIN Statement
lappend non_terminals retainStatement {
line RETAIN designator
}
# (39.3) RELEASE Statement
lappend non_terminals releaseStatement {
line RELEASE designator
}
# (40) Update Or Procedure Call
lappend non_terminals updateOrProcCall {
or
{line designator
{or incOrDecSuffix {line ( expressionList )} nil}}
{line targetDesignator := expression}
}
# (40b) LL(1) Variant of Update Or Procedure Call
# resulting illegal combinations not in compliance
# with rule (40) must be rejected programmatically
#lappend non_terminals updateOrProcCall {
# line targetDesignator {
# or
# {line incOrDecSuffix}
# {line := expression}
# {line ( expressionList )}
# nil
# }
#}
# (40.1) Increment Or Decrement Suffix
lappend non_terminals incOrDecSuffix {
or
{line ++}
{line --}
}
# (41) RETURN Statement
lappend non_terminals returnStatement {
line RETURN {optx expression}
}
# (42) COPY Statement
lappend non_terminals copyStatement {
line COPY targetDesignator := expression
}
# (43) READ Statement
lappend non_terminals readStatement {
line READ {optx @ chan :}
{loop inputArg ,}
}
# (43.1) Channel
lappend non_terminals chan {
line designator
}
# (43.2) Input Argument
lappend non_terminals inputArg {
line {optx NEW} designator
}
# (44) WRITE Statement
lappend non_terminals writeStatement {
line WRITE {optx @ chan :}
{loop outputArgs ,}
}
# 44.1) Output Arguments
lappend non_terminals outputArgs {
or formattedArgs unformattedArg
}
# (44.2) Formatted Arguments
lappend non_terminals formattedArgs {
line OCTOTHORPE ( fmtStr , expressionList )
}
# (44.3) Unformatted Argument
lappend non_terminals unformattedArg {
line expression
}
# (44.4) Format String
lappend non_terminals fmtStr {
line expression
}
# (45) IF Statement
lappend non_terminals ifStatement {
stack
{line IF boolExpression THEN statementSequence}
{optx {loop {line ELSIF boolExpression THEN statementSequence} nil}}
{line {optx ELSE statementSequence} END}
}
# (45.1) Boolean Expression
lappend non_terminals boolExpression {
line expression
}
# (46) CASE Statement
lappend non_terminals caseStatement {
line CASE expression OF
{loop {line | case} nil} {optx ELSE statementSequence} END
}
# (46) CASE Statement (wrapped)
lappend non_terminals caseStatement2 {
stack
{line CASE expression OF {loop {line | case} nil}}
{line {optx ELSE statementSequence} END}
}
# (46.1) Case
lappend non_terminals case {
line {loop caseLabels ,} : statementSequence
}
# (46.2) Case Labels
lappend non_terminals caseLabels {
line constExpression {optx .. constExpression}
}
# (47) LOOP Statement
lappend non_terminals loopStatement {
line LOOP statementSequence END
}
# (48) WHILE Statement
lappend non_terminals whileStatement {
line WHILE boolExpression DO statementSequence END
}
# (48) WHILE Statement (wrapped)
lappend non_terminals whileStatement2 {
stack
{line WHILE boolExpression DO statementSequence}
{line {optx ELSE statementSequence} END}
}
# (49) REPEAT Statement
lappend non_terminals repeatStatement {
line REPEAT statementSequence UNTIL boolExpression
}
# (50) FOR Statement
lappend non_terminals forStatement {
line FOR forLoopVariants IN iterableExpr DO statementSequence END
}
# (50) FOR Statement (wrapped)
lappend non_terminals forStatement2 {
stack
{line FOR forLoopVariants IN iterableExpr}
{line DO statementSequence END}
}
# (50.1) FOR Loop Variants
lappend non_terminals forLoopVariants {
line accessor {optx descender} {optx , value}
}
# (50.2) Accessor, Value
lappend non_terminals accessor {
line StdIdent
}
# (50.3) Descender
lappend non_terminals descender {
line --
}
# (50.4) Iterable Expression
lappend non_terminals iterableExpr {
line collectionOrType {optx valueRange}
}
# (50.5) Collection Or Type
lappend non_terminals collectionOrType {
line qualident
}
# (50.6) Value Range
lappend non_terminals valueRange {
line [ firstValue .. lastValue ]
}
# (50.7) First Value
lappend non_terminals firstValue {
line expression
}
# (50.8) Last Value
lappend non_terminals lastValue {
line expression
}
# (51a) Designator
lappend non_terminals designator {
line qualident {or derefTail subscriptTail nil}
}
# (51a.1) Dereferenced Designator Tail
lappend non_terminals derefTail {
line deref {or {line . designator} subscriptTail nil}
}
# (51a.2) Subscripted Designator Tail
lappend non_terminals subscriptTail {
line [ expression ] {or {line . designator} derefTail nil}
}
# (51b) Target Designator
lappend non_terminals targetDesignator {
line qualident {or derefTargetTail bracketTargetTail nil}
}
# (51b.1) Dereferenced Target Designator Tail
lappend non_terminals derefTargetTail {
line deref {or {line . targetDesignator} bracketTargetTail nil}
}
# (51b.2) Bracketed Target Designator Tail
lappend non_terminals bracketTargetTail {
line [ expression {
or
{line ] {or {line . targetDesignator} derefTargetTail nil}}
{line .. {optx expression} ]}
}
}
# (51.2) Deref
lappend non_terminals deref {
loop ^ nil
}
# (52) Expression List
lappend non_terminals expressionList {
loop expression ,
}
# (53) Expression
lappend non_terminals expression {
line simpleExpression {optx operL1 simpleExpression}
}
# (53.1) Level-1 Operator
lappend non_terminals operL1 {
or
= # < <= > >= == IN
}
# (54) Simple Expression
lappend non_terminals simpleExpression {
or
{loop term operL2}
{line - factor}
}
# (54.1) Level-2 Operator
lappend non_terminals operL2 {
or + - OR concatOp setDiffOp
}
# (54.2) Concatenation Operator
lappend non_terminals concatOp {
line &
}
# (54.3) Set Difference Operator
lappend non_terminals setDiffOp {
line BACKSLASH
}
# (55) Term
lappend non_terminals term {
loop simpleTerm operL3
}
# (55.1) Level-3 Operator
lappend non_terminals operL3 {
or * / DIV MOD AND
}
# (56) Simple Term
lappend non_terminals simpleTerm {
line {optx NOT} factor
}
# (57) Factor
lappend non_terminals factor {
line simpleFactor {optx typeConvOp typeIdent}
}
# (57.1) Type Conversion Operator
lappend non_terminals typeConvOp {
line ::
}
# (58) Simple Factor
lappend non_terminals simpleFactor {
line {
or
NumberLiteral
StringLiteral
structuredValue
sourceDesignator
{line ( expression )}
}
}
# (59) Source Designator
lappend non_terminals sourceDesignator {
line qualident
{or functionCallTail derefSourceTail bracketSourceTail nil}
}
# (59.1) Dereferenced Source Designator Tail
lappend non_terminals derefSourceTail {
line deref
{or {line . sourceDesignator} functionCallTail bracketSourceTail nil}
}
# (59.2) Bracketed Source Designator Tail
lappend non_terminals bracketSourceTail {
line [ expression {
or
{line ] {or {line . sourceDesignator} functionCallTail derefSourceTail nil}}
{line .. expression ]}
}
}
# (59.3) Function Call Tail
lappend non_terminals functionCallTail {
line ( {optx expressionList} )
}
# (60) Structured Value
lappend non_terminals structuredValue {
line LBRACE {
or
{loop valueComponent ,}
*
} RBRACE
}
# (60.1) Value Component
lappend non_terminals valueComponent {
or
{line constExpression {optx .. constExpression}}
{line runtimeExpression}
}
# (60.2) Runtime Expression
lappend non_terminals runtimeExpression {
line expression
}
# (61) TO DO List
lappend non_terminals toDoList {
line TO DO {
or
{line {optx trackingRef} {loop taskToDo ;} END}
nil
}
}
# (61.1) Tracking Reference
lappend non_terminals trackingRef {
line ( issueId {optx , severity , description } )
}
# (61.2) Task To Do
lappend non_terminals taskToDo {
line description {optx , estimatedTime timeUnit }
}
# (61.3) IssueId, Severity, Estimated Time
lappend non_terminals issueId {
line wholeNumber
}