Sync with 5.4.0
[deliverable/titan.core.git] / parser / parser.y
1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8
9 /*
10
11 Parser source code for TTCN-3 (input of bison)
12 Rev: PA10
13 Date: April 15 2005
14 Author: Janos Zoltan Szabo (ejnosza)
15
16 Revision history:
17
18 Rev. Date Author Comments
19 PA1 Nov 10 2000 tmpjsz Generated from the prototype compiler.
20 (Actions were removed.)
21 PA2 Dec 5 2000 tmpjsz Many minor changes.
22 Updated according to BNF v1.0.9.
23 PA3 Dec 11 2000 tmpjsz Added support for module definitive
24 identifiers.
25 PA5 Sep 19 - Oct 1 2001 tmpjsz Upgrade to BNF v1.1.2.
26 PA6 Apr 16-18 2002 tmpjsz Upgrade to BNF v2.2.0 (Rev. 12.5)
27 PA7 Nov 26-27 2002 tmpjsz Upgrade to BNF v2.2.1 (Rev. 12.7)
28 PA8 May 10-13 2004 ejnosza Upgrade to BNF v3.0.0Mockupv1
29 PA9 March 2005 ejnosza Added support for multi-dimension
30 sub-references in port/timer/component
31 operations.
32 PA10 Apr 13-15 2005 ejnosza Upgrade to final BNF v3.0.0
33
34 */
35
36 %{
37
38 #include <stdio.h>
39 #include <string.h>
40 #include <stdlib.h>
41 #include <errno.h>
42
43 void yyerror(char *s);
44 int yylex();
45
46 #define YYERROR_VERBOSE
47
48 %}
49
50 /* Bison declarations */
51
52 /* Terminal symbols of TTCN-3 */
53
54 /* Inline constants */
55
56 %token Number
57 %token FloatValue
58 %token Identifier
59
60 %token BooleanConst
61 %token VerdictConst
62 %token Bstring
63 %token Hstring
64 %token Ostring
65 %token Cstring
66 %token NullKeyword
67 %token BitStringMatch
68 %token HexStringMatch
69 %token OctetStringMatch
70
71 /* Keywords */
72
73 %token ActionKeyword
74 %token ActivateKeyword
75 %token AddressKeyword
76 %token AliveKeyword
77 %token AllKeyword
78 %token AltKeyword
79 %token AltstepKeyword
80 %token AnyKeyword
81 %token AnyTypeKeyword
82 %token BitStringKeyword
83 %token BooleanKeyword
84 %token CallOpKeyword
85 %token CaseKeyword
86 %token CatchOpKeyword
87 %token CharKeyword
88 %token CharStringKeyword
89 %token CheckOpKeyword
90 %token ClearOpKeyword
91 %token ComplementKeyword
92 %token ComponentKeyword
93 %token ConnectKeyword
94 %token ConstKeyword
95 %token ControlKeyword
96 %token CreateKeyword
97 %token DeactivateKeyword
98 %token DefaultKeyword
99 %token DisconnectKeyword
100 %token DisplayKeyword
101 %token DoKeyword
102 %token DoneKeyword
103 %token ElseKeyword
104 %token EncodeKeyword
105 %token EnumKeyword
106 %token ExceptKeyword
107 %token ExceptionKeyword
108 %token ExecuteKeyword
109 %token ExtendsKeyword
110 %token ExtensionKeyword
111 %token ExtKeyword
112 %token FloatKeyword
113 %token ForKeyword
114 %token FromKeyword
115 %token FunctionKeyword
116 %token GetCallOpKeyword
117 %token GetReplyOpKeyword
118 %token GetVerdictKeyword
119 %token GotoKeyword
120 %token GroupKeyword
121 %token HexStringKeyword
122 %token IfKeyword
123 %token IfPresentKeyword
124 %token ImportKeyword
125 %token InParKeyword
126 %token InfinityKeyword
127 %token InOutParKeyword
128 %token IntegerKeyword
129 %token InterleavedKeyword
130 %token KillKeyword
131 %token KilledKeyword
132 %token LabelKeyword
133 %token LanguageKeyword
134 %token LengthKeyword
135 %token LogKeyword
136 %token MapKeyword
137 %token MatchKeyword
138 %token MessageKeyword
139 %token MixedKeyword
140 %token ModifiesKeyword
141 %token TTCN3ModuleKeyword
142 %token ModuleParKeyword
143 %token MTCKeyword
144 %token NoBlockKeyword
145 %token NowaitKeyword
146 %token ObjectIdentifierKeyword
147 %token OctetStringKeyword
148 %token OfKeyword
149 %token OmitKeyword
150 %token OnKeyword
151 %token OptionalKeyword
152 %token OutParKeyword
153 %token OverrideKeyword
154 %token ParamKeyword
155 %token PatternKeyword
156 %token PermutationKeyword
157 %token PortKeyword
158 %token ProcedureKeyword
159 %token RaiseKeyword
160 %token ReadKeyword
161 %token ReceiveOpKeyword
162 %token RecordKeyword
163 %token RecursiveKeyword
164 %token RepeatKeyword
165 %token ReplyKeyword
166 %token ReturnKeyword
167 %token RunningKeyword
168 %token RunsKeyword
169 %token SelectKeyword
170 %token SelfOp
171 %token SendOpKeyword
172 %token SenderKeyword
173 %token SetKeyword
174 %token SetVerdictKeyword
175 %token SignatureKeyword
176 %token StartKeyword
177 %token StopKeyword
178 %token SubsetKeyword
179 %token SupersetKeyword
180 %token SystemKeyword
181 %token TemplateKeyword
182 %token TestcaseKeyword
183 %token TimeoutKeyword
184 %token TimerKeyword
185 %token ToKeyword
186 %token TriggerOpKeyword
187 %token TypeDefKeyword
188 %token UnionKeyword
189 %token UniversalKeyword
190 %token UnmapKeyword
191 %token ValueKeyword
192 %token ValueofKeyword
193 %token VarKeyword
194 %token VariantKeyword
195 %token VerdictTypeKeyword
196 %token WhileKeyword
197 %token WithKeyword
198
199 /* Keywords combined with a leading dot */
200
201 %token DotAliveKeyword
202 %token DotCallOpKeyword
203 %token DotCatchOpKeyword
204 %token DotCheckOpKeyword
205 %token DotClearOpKeyword
206 %token DotCreateKeyword
207 %token DotDoneKeyword
208 %token DotGetCallOpKeyword
209 %token DotGetReplyOpKeyword
210 %token DotKillKeyword
211 %token DotKilledKeyword
212 %token DotRaiseKeyword
213 %token DotReadKeyword
214 %token DotReceiveOpKeyword
215 %token DotReplyKeyword
216 %token DotRunningKeyword
217 %token DotSendOpKeyword
218 %token DotStartKeyword
219 %token DotStopKeyword
220 %token DotTimeoutKeyword
221 %token DotTriggerOpKeyword
222
223 /* Multi-character operators */
224
225 %token AssignmentChar ":="
226 %token DotDot ".."
227 %token PortRedirectSymbol "->"
228 %token EQ "=="
229 %token NE "!="
230 %token GE ">="
231 %token LE "<="
232 %token Or "or"
233 %token Or4b "or4b"
234 %token Xor "xor"
235 %token Xor4b "xor4b"
236 %token Mod "mod"
237 %token Rem "rem"
238 %token And "and"
239 %token And4b "and4b"
240 %token Not "not"
241 %token Not4b "not4b"
242 %token SL "<<"
243 %token SR ">>"
244 %token RL "<@"
245 %token RR "@>"
246
247 /* Operator precedences */
248
249 /*
250 %left Or
251 %left Xor
252 %left And
253 %left Not
254 %left EQ NE
255 %left '<' '>' GE LE
256 %left SL SR RL RR
257 %left Or4b
258 %left Xor4b
259 %left And4b
260 %left Not4b
261 %left '+' '-' '&'
262 %left '*' '/' Mod Rem
263 %left UnarySign
264 */
265
266 %expect 16
267
268 /*
269 Source of conflicts (16 S/R):
270
271 1.) 7 conflicts in one state
272 The Expression after 'return' keyword is optional in ReturnStatement.
273 For 7 tokens the parser cannot decide whether the token is a part of
274 the return expression (shift) or it is the beginning of the next statement
275 (reduce).
276
277 2.) 8 distinct states, each with one conflict caused by token '['
278 The local definitions in altsteps can be followed immediately by the guard
279 expression. When the parser sees the '[' token it cannot decide whether it
280 belongs to the local definition as array dimension or array subreference
281 (shift) or it is the beginning of the first guard expression (reduce).
282 The situations are the following:
283 - var t v := ref <here> [
284 - var t v := ref[subref] <here> [
285 - var t v := ref.integer <here> [
286 - var t v := ref.subref <here> [
287 - timer t <here> [
288 - var t v <here> [
289 - var t v := ref.objid{...}.subref <here> [
290 - var template t v <here> [
291
292 3.) 1 conflict
293 The sequence identifier.objid can be either the beginning of a module name
294 qualified with a module object identifier (shift) or a reference to an objid
295 value within an entity of type anytype (reduce).
296
297 Note that the parser implemented by bison always chooses to shift instead of
298 reduce in case of conflicts. This is the desired behaviour in situations 1.)
299 and 2.) since the opposite alternative can be forced by the correct usage
300 of semi-colons.
301 */
302
303 %%
304
305 /* The grammar of TTCN-3 */
306
307 /* A.1.6.0 TTCN-3 module */
308
309 TTCN3Module:
310 TTCN3ModuleKeyword TTCN3ModuleId
311 '{'
312 optModuleDefinitionsPart
313 optModuleControlPart
314 '}'
315 optWithStatementAndSemiColon
316 ;
317
318 TTCN3ModuleId:
319 Identifier optDefinitiveIdentifier optLanguageSpec
320 ;
321
322 ModuleId:
323 GlobalModuleId optLanguageSpec
324 ;
325
326 GlobalModuleId:
327 Identifier
328 | Identifier ObjectIdentifierValue
329 ;
330
331 optLanguageSpec:
332 /* empty */
333 | LanguageKeyword FreeText
334 ;
335
336 /* A.1.6.1 Module definitions part */
337
338 /* A.1.6.1.0 General */
339
340 optModuleDefinitionsPart:
341 /* empty */
342 | ModuleDefinitionsList
343 ;
344
345 ModuleDefinitionsList:
346 ModuleDefinition optSemiColon
347 | ModuleDefinitionsList ModuleDefinition optSemiColon
348 ;
349
350 ModuleDefinition:
351 ModuleDef optWithStatement
352 ;
353
354 ModuleDef:
355 TypeDef
356 | ConstDef
357 | TemplateDef
358 | ModuleParDef
359 | FunctionDef
360 | SignatureDef
361 | TestcaseDef
362 | AltstepDef
363 | ImportDef
364 | GroupDef
365 | ExtFunctionDef
366 | ExtConstDef
367 ;
368
369 /* A.1.6.1.1 Typedef definitions */
370
371 TypeDef:
372 TypeDefKeyword TypeDefBody
373 ;
374
375 TypeDefBody:
376 StructuredTypeDef
377 | SubTypeDef
378 ;
379
380 StructuredTypeDef:
381 RecordDef
382 | UnionDef
383 | SetDef
384 | RecordOfDef
385 | SetOfDef
386 | EnumDef
387 | PortDef
388 | ComponentDef
389 ;
390
391 RecordDef:
392 RecordKeyword StructDefBody
393 ;
394
395 StructDefBody:
396 Identifier optStructDefFormalParList
397 '{' optStructFieldDefList '}'
398 | AddressKeyword '{' optStructFieldDefList '}'
399 ;
400
401 optStructDefFormalParList:
402 /* empty */
403 | '(' StructDefFormalParList ')'
404 ;
405
406 StructDefFormalParList:
407 StructDefFormalPar
408 | StructDefFormalParList ',' StructDefFormalPar
409 ;
410
411 StructDefFormalPar:
412 FormalValuePar
413 ;
414
415 optStructFieldDefList:
416 /* empty */
417 | StructFieldDefList
418 ;
419
420 StructFieldDefList:
421 StructFieldDef
422 | StructFieldDefList ',' StructFieldDef
423 ;
424
425 StructFieldDef:
426 TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec
427 | TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec
428 OptionalKeyword
429 ;
430
431 TypeOrNestedTypeDef:
432 Type
433 | NestedTypeDef
434 ;
435
436 NestedTypeDef:
437 NestedRecordDef
438 | NestedUnionDef
439 | NestedSetDef
440 | NestedRecordOfDef
441 | NestedSetOfDef
442 | NestedEnumDef
443 ;
444
445 NestedRecordDef:
446 RecordKeyword '{' optStructFieldDefList '}'
447 ;
448
449 NestedUnionDef:
450 UnionKeyword '{' UnionFieldDefList '}'
451 ;
452
453 NestedSetDef:
454 SetKeyword '{' optStructFieldDefList '}'
455 ;
456
457 NestedRecordOfDef:
458 RecordKeyword optStringLength OfKeyword TypeOrNestedTypeDef
459 ;
460
461 NestedSetOfDef:
462 SetKeyword optStringLength OfKeyword TypeOrNestedTypeDef
463 ;
464
465 NestedEnumDef:
466 EnumKeyword '{' EnumerationList '}'
467 ;
468
469 UnionDef:
470 UnionKeyword UnionDefBody
471 ;
472
473 UnionDefBody:
474 Identifier optStructDefFormalParList '{' UnionFieldDefList '}'
475 | AddressKeyword '{' UnionFieldDefList '}'
476
477 ;
478
479 UnionFieldDefList:
480 UnionFieldDef
481 | UnionFieldDefList ',' UnionFieldDef
482 ;
483
484 UnionFieldDef:
485 TypeOrNestedTypeDef Identifier optArrayDef optSubTypeSpec
486 ;
487
488 SetDef:
489 SetKeyword StructDefBody
490 ;
491
492 RecordOfDef:
493 RecordKeyword optStringLength OfKeyword StructOfDefBody
494 ;
495
496 StructOfDefBody:
497 TypeOrNestedTypeDef Identifier optSubTypeSpec
498 | TypeOrNestedTypeDef AddressKeyword optSubTypeSpec
499 ;
500
501 SetOfDef:
502 SetKeyword optStringLength OfKeyword StructOfDefBody
503 ;
504
505 EnumDef:
506 EnumKeyword Identifier '{' EnumerationList '}'
507 | EnumKeyword AddressKeyword '{' EnumerationList '}'
508 ;
509
510 EnumerationList:
511 Enumeration
512 | EnumerationList ',' Enumeration
513 ;
514
515 Enumeration:
516 Identifier
517 | Identifier '(' Number ')'
518 | Identifier '(' Minus Number ')'
519 ;
520
521 SubTypeDef:
522 Type Identifier optArrayDef optSubTypeSpec
523 | Type AddressKeyword optArrayDef optSubTypeSpec
524 ;
525
526 optSubTypeSpec:
527 /* empty */
528 | AllowedValues
529 | AllowedValues StringLength
530 | StringLength
531 ;
532
533 AllowedValues:
534 '(' seqValueOrRange ')'
535 | CharStringMatch
536 ;
537
538 seqValueOrRange:
539 ValueOrRange
540 | seqValueOrRange ',' ValueOrRange
541 ;
542
543 ValueOrRange:
544 RangeDef
545 | Expression
546 ;
547
548 RangeDef:
549 LowerBound DotDot UpperBound
550 ;
551
552 optStringLength:
553 /* empty */
554 | StringLength
555 ;
556
557 StringLength:
558 LengthKeyword '(' SingleExpression ')'
559 | LengthKeyword '(' SingleExpression DotDot UpperBound ')'
560 ;
561
562 PortType:
563 Identifier
564 | Identifier Dot Identifier
565 | Identifier Dot ObjectIdentifierValue Dot Identifier
566 ;
567
568 PortDef:
569 PortKeyword PortDefBody
570 ;
571
572 PortDefBody:
573 Identifier PortDefAttribs
574 ;
575
576 PortDefAttribs:
577 MessageAttribs
578 | ProcedureAttribs
579 | MixedAttribs
580 ;
581
582 MessageAttribs:
583 MessageKeyword
584 '{' MessageListList '}'
585 ;
586
587 MessageListList:
588 MessageList optSemiColon
589 | MessageListList MessageList optSemiColon
590 ;
591
592 MessageList:
593 Direction AllOrTypeList
594 ;
595
596 Direction:
597 InParKeyword
598 | OutParKeyword
599 | InOutParKeyword
600 ;
601
602 AllOrTypeList:
603 AllKeyword
604 | TypeList
605 ;
606
607 TypeList:
608 Type
609 | TypeList ',' Type
610 ;
611
612 ProcedureAttribs:
613 ProcedureKeyword
614 '{' ProcedureListList '}'
615 ;
616
617 ProcedureListList:
618 ProcedureList optSemiColon
619 | ProcedureListList ProcedureList optSemiColon
620 ;
621
622 ProcedureList:
623 Direction AllOrSignatureList
624 ;
625
626 AllOrSignatureList:
627 AllKeyword
628 | SignatureList
629 ;
630
631 SignatureList:
632 Signature
633 | SignatureList ',' Signature
634 ;
635
636 MixedAttribs:
637 MixedKeyword
638 '{' MixedListList '}'
639 ;
640
641 MixedListList:
642 MixedList optSemiColon
643 | MixedListList MixedList optSemiColon
644 ;
645
646 MixedList:
647 Direction ProcOrTypeList
648 ;
649
650 ProcOrTypeList:
651 seqProcOrType
652 | AllKeyword
653 ;
654
655 seqProcOrType:
656 ProcOrType
657 | seqProcOrType ',' ProcOrType
658 ;
659
660 ProcOrType:
661 /* Signature -- covered by Type */
662 Type
663 ;
664
665 ComponentDef:
666 ComponentKeyword Identifier
667 optExtendsDef
668 '{' ComponentDefList '}'
669 ;
670
671 optExtendsDef:
672 /* empty */
673 | ExtendsKeyword ComponentTypeList
674 ;
675
676 ComponentTypeList:
677 ComponentType
678 | ComponentTypeList ',' ComponentType
679 ;
680
681 ComponentType:
682 Identifier
683 | Identifier Dot Identifier
684 | Identifier Dot ObjectIdentifierValue Dot Identifier
685 ;
686
687 ComponentDefList:
688 /* empty */
689 | ComponentDefList ComponentElementDef optSemiColon
690 ;
691
692 ComponentElementDef:
693 PortInstance
694 | VarInstance
695 | TimerInstance
696 | ConstDef
697 ;
698
699 PortInstance:
700 PortKeyword PortType PortElementList
701 ;
702
703 PortElementList:
704 PortElement
705 | PortElementList ',' PortElement
706 ;
707
708 PortElement:
709 Identifier optArrayDef
710 ;
711
712 /* A.1.6.1.2 Constant definitions */
713
714 ConstDef:
715 ConstKeyword Type ConstList
716 ;
717
718 ConstList:
719 SingleConstDef
720 | ConstList ',' SingleConstDef
721 ;
722
723 SingleConstDef:
724 Identifier optArrayDef AssignmentChar Expression
725 ;
726
727 /* A.1.6.1.3 Template definitions */
728
729 TemplateDef:
730 TemplateKeyword BaseTemplate optDerivedDef AssignmentChar TemplateBody
731 ;
732
733 BaseTemplate:
734 Type Identifier optTemplateFormalParList
735 /* | Signature Identifier optTemplateFormalParList -- covered by
736 the previous rule */
737 ;
738
739 optDerivedDef:
740 /* empty */
741 | ModifiesKeyword TemplateRef
742 ;
743
744 optTemplateFormalParList:
745 /* empty */
746 | '(' TemplateFormalParList ')'
747 ;
748
749 TemplateFormalParList:
750 TemplateFormalPar
751 | TemplateFormalParList ',' TemplateFormalPar
752 ;
753
754 TemplateFormalPar:
755 FormalValuePar
756 | FormalTemplatePar
757 ;
758
759 TemplateBody:
760 SimpleSpec optExtraMatchingAttributes
761 | FieldSpecList optExtraMatchingAttributes
762 | ArrayValueOrAttrib optExtraMatchingAttributes
763 ;
764
765 SimpleSpec:
766 SingleValueOrAttrib
767 ;
768
769 FieldSpecList:
770 '{' '}'
771 | '{' seqFieldSpec '}'
772 ;
773
774 seqFieldSpec:
775 FieldSpec
776 | seqFieldSpec ',' FieldSpec
777 ;
778
779 FieldSpec:
780 FieldReference AssignmentChar TemplateBody
781 ;
782
783 FieldReference:
784 StructFieldRef
785 | ArrayOrBitRef
786 /* | ParRef -- covered by StructFieldRef */
787 ;
788
789 StructFieldRef:
790 Identifier
791 | PredefinedType
792 /* | TypeReference
793 Note: Non-parameterized type references are covered by (StructField)Identifier.
794 Parameterized type references are covered by FunctionInstance */
795 | FunctionInstance
796 ;
797
798 ParRef:
799 Identifier
800 ;
801
802 ArrayOrBitRef:
803 '[' FieldOrBitNumber ']'
804 ;
805
806 FieldOrBitNumber:
807 SingleExpression
808 ;
809
810 SingleValueOrAttrib:
811 MatchingSymbol
812 | SingleExpression
813 /* | TemplateRefWithParList -- covered by SingleExpression */
814 ;
815
816 ArrayValueOrAttrib:
817 '{' ArrayElementSpecList '}'
818 ;
819
820 ArrayElementSpecList:
821 ArrayElementSpec
822 | ArrayElementSpecList ',' ArrayElementSpec
823 ;
824
825 ArrayElementSpec:
826 NotUsedSymbol
827 | PermutationMatch
828 | TemplateBody
829 ;
830
831 NotUsedSymbol:
832 Dash
833 ;
834
835 MatchingSymbol:
836 Complement
837 | AnyValue
838 | AnyOrOmit
839 | ValueOrAttribList
840 | Range
841 | BitStringMatch
842 | HexStringMatch
843 | OctetStringMatch
844 | CharStringMatch
845 | SubsetMatch
846 | SupersetMatch
847 ;
848
849 optExtraMatchingAttributes:
850 /* empty */
851 | LengthMatch
852 | IfPresentMatch
853 | LengthMatch IfPresentMatch
854 ;
855
856 CharStringMatch:
857 PatternKeyword Cstring
858 ;
859
860 Complement:
861 ComplementKeyword ValueList
862 ;
863
864 ValueList:
865 '(' seqValue ')'
866 ;
867
868 seqValue:
869 Expression
870 | seqValue ',' Expression
871 ;
872
873 SubsetMatch:
874 SubsetKeyword ValueList
875 ;
876
877 SupersetMatch:
878 SupersetKeyword ValueList
879 ;
880
881 PermutationMatch:
882 PermutationKeyword PermutationList
883 ;
884
885 PermutationList:
886 '(' seqValueOrAttrib ')'
887 ;
888
889 AnyValue:
890 '?'
891 ;
892
893 AnyOrOmit:
894 '*'
895 ;
896
897 ValueOrAttribList:
898 '(' TemplateBody ',' seqValueOrAttrib ')'
899 ;
900
901 seqValueOrAttrib:
902 TemplateBody
903 | seqValueOrAttrib ',' TemplateBody
904 ;
905
906 LengthMatch:
907 StringLength
908 ;
909
910 IfPresentMatch:
911 IfPresentKeyword
912 ;
913
914 Range:
915 '(' LowerBound DotDot UpperBound ')'
916 ;
917
918 LowerBound:
919 SingleExpression
920 | Minus InfinityKeyword
921 ;
922
923 UpperBound:
924 SingleExpression
925 | InfinityKeyword
926 ;
927
928 TemplateInstance:
929 InLineTemplate
930 ;
931
932 TemplateRefWithParList:
933 Identifier optTemplateActualParList
934 | Identifier Dot Identifier optTemplateActualParList
935 | Identifier Dot ObjectIdentifierValue Dot Identifier
936 optTemplateActualParList
937 ;
938
939 TemplateRef:
940 Identifier
941 | Identifier Dot Identifier
942 | Identifier Dot ObjectIdentifierValue Dot Identifier
943 ;
944
945 InLineTemplate:
946 TemplateBody
947 | Type Colon TemplateBody
948 /* | Signature Colon TemplateBody -- covered by the previous rule */
949 | DerivedRefWithParList AssignmentChar TemplateBody
950 | Type Colon DerivedRefWithParList AssignmentChar TemplateBody
951 /* | Signature Colon DerivedRefWithParList AssignmentChar TemplateBody
952 -- covered by the previous rule */
953 ;
954
955 DerivedRefWithParList:
956 ModifiesKeyword TemplateRefWithParList
957 ;
958
959 optTemplateActualParList:
960 /* empty */
961 | '(' seqTemplateActualPar ')'
962 ;
963
964 seqTemplateActualPar:
965 TemplateActualPar
966 | seqTemplateActualPar ',' TemplateActualPar
967 ;
968
969 TemplateActualPar:
970 TemplateInstance
971 ;
972
973 TemplateOps:
974 MatchOp
975 | ValueofOp
976 ;
977
978 MatchOp:
979 MatchKeyword '(' Expression ',' TemplateInstance ')'
980 ;
981
982 ValueofOp:
983 ValueofKeyword '(' TemplateInstance ')'
984 ;
985
986 /* A.1.6.1.4 Function definitions */
987
988 FunctionDef:
989 FunctionKeyword Identifier
990 '(' optFunctionFormalParList ')' optRunsOnSpec optReturnType
991 StatementBlock
992 ;
993
994 optFunctionFormalParList:
995 /* empty */
996 | FunctionFormalParList
997 ;
998
999 FunctionFormalParList:
1000 FunctionFormalPar
1001 | FunctionFormalParList ',' FunctionFormalPar
1002 ;
1003
1004 FunctionFormalPar:
1005 FormalValuePar
1006 | FormalTimerPar
1007 | FormalTemplatePar
1008 /* | FormalPortPar -- covered by FormalValuePar */
1009 ;
1010
1011 optReturnType:
1012 /* empty */
1013 | ReturnType
1014 ;
1015
1016 ReturnType:
1017 ReturnKeyword Type
1018 | ReturnKeyword TemplateKeyword Type
1019 ;
1020
1021 optRunsOnSpec:
1022 /* empty */
1023 | RunsOnSpec
1024 ;
1025
1026 RunsOnSpec:
1027 RunsKeyword OnKeyword ComponentType
1028 ;
1029
1030 StatementBlock:
1031 '{' optFunctionStatementOrDefList '}'
1032 ;
1033
1034 optFunctionStatementOrDefList:
1035 /* empty */
1036 | optFunctionStatementOrDefList FunctionStatementOrDef optSemiColon
1037 ;
1038
1039 FunctionStatementOrDef:
1040 FunctionLocalDef
1041 | FunctionLocalInst
1042 | FunctionStatement
1043 ;
1044
1045 FunctionLocalInst:
1046 VarInstance
1047 | TimerInstance
1048 ;
1049
1050 FunctionLocalDef:
1051 ConstDef
1052 | TemplateDef
1053 ;
1054
1055 FunctionStatement:
1056 ConfigurationStatements
1057 | TimerStatements
1058 | CommunicationStatements
1059 | BasicStatements
1060 | BehaviourStatements
1061 | VerdictStatements
1062 | SUTStatements
1063 ;
1064
1065 FunctionInstance:
1066 Identifier '(' optFunctionActualParList ')'
1067 | Identifier Dot Identifier '(' optFunctionActualParList ')'
1068 | Identifier Dot ObjectIdentifierValue Dot Identifier
1069 '(' optFunctionActualParList ')'
1070 ;
1071
1072 optFunctionActualParList:
1073 /* empty */
1074 | FunctionActualParList
1075 ;
1076
1077 FunctionActualParList:
1078 FunctionActualPar
1079 | FunctionActualParList ',' FunctionActualPar
1080 ;
1081
1082 FunctionActualPar:
1083 /* TimerRef */
1084 TemplateInstance
1085 /* | Port
1086 | ComponentRef -- TemplateInstance covers all the others */
1087 ;
1088
1089 /* A.1.6.1.5 Signature definitions */
1090
1091 SignatureDef:
1092 SignatureKeyword Identifier
1093 '(' optSignatureFormalParList ')' optReturnTypeOrNoBlockKeyword
1094 optExceptionSpec
1095 ;
1096
1097 optSignatureFormalParList:
1098 /* empty */
1099 | SignatureFormalParList
1100 ;
1101
1102 SignatureFormalParList:
1103 SignatureFormalPar
1104 | SignatureFormalParList ',' SignatureFormalPar
1105 ;
1106
1107 SignatureFormalPar:
1108 FormalValuePar
1109 ;
1110
1111 optReturnTypeOrNoBlockKeyword:
1112 /* empty */
1113 | ReturnType
1114 | NoBlockKeyword
1115 ;
1116
1117 optExceptionSpec:
1118 /* empty */
1119 | ExceptionKeyword '(' ExceptionTypeList ')'
1120 ;
1121
1122 ExceptionTypeList:
1123 Type
1124 | ExceptionTypeList ',' Type
1125 ;
1126
1127 Signature:
1128 Identifier
1129 | Identifier Dot Identifier
1130 | Identifier Dot ObjectIdentifierValue Dot Identifier
1131 ;
1132
1133 /* A.1.6.1.6 Testcase definitions */
1134
1135 TestcaseDef:
1136 TestcaseKeyword Identifier
1137 '(' optTestcaseFormalParList ')' ConfigSpec
1138 StatementBlock
1139 ;
1140
1141 optTestcaseFormalParList:
1142 /* empty */
1143 | TestcaseFormalParList
1144 ;
1145
1146 TestcaseFormalParList:
1147 TestcaseFormalPar
1148 | TestcaseFormalParList ',' TestcaseFormalPar
1149 ;
1150
1151 TestcaseFormalPar:
1152 FormalValuePar
1153 | FormalTemplatePar
1154 ;
1155
1156 ConfigSpec:
1157 RunsOnSpec optSystemSpec
1158 ;
1159
1160 optSystemSpec:
1161 /* empty */
1162 | SystemKeyword ComponentType
1163 ;
1164
1165 TestcaseInstance:
1166 ExecuteKeyword '(' TestcaseRef '(' optTestcaseActualParList ')'
1167 optTestcaseTimerValue ')'
1168 ;
1169
1170 TestcaseRef:
1171 Identifier
1172 | Identifier Dot Identifier
1173 | Identifier Dot ObjectIdentifierValue Dot Identifier
1174 ;
1175
1176 optTestcaseTimerValue:
1177 /* empty */
1178 | ',' TimerValue
1179 ;
1180
1181 optTestcaseActualParList:
1182 /* empty */
1183 | TestcaseActualParList
1184 ;
1185
1186 TestcaseActualParList:
1187 TestcaseActualPar
1188 | TestcaseActualParList ',' TestcaseActualPar
1189 ;
1190
1191 TestcaseActualPar:
1192 TemplateInstance
1193 ;
1194
1195 /* A.1.6.1.7 Altstep definitions */
1196
1197 AltstepDef:
1198 AltstepKeyword Identifier
1199 '(' optAltstepFormalParList ')' optRunsOnSpec
1200 '{' AltstepLocalDefList AltGuardList '}'
1201 ;
1202
1203 optAltstepFormalParList:
1204 /* empty */
1205 | FunctionFormalParList
1206 ;
1207
1208 AltstepLocalDefList:
1209 /* empty */
1210 | AltstepLocalDefList AltstepLocalDef optSemiColon
1211 ;
1212
1213 AltstepLocalDef:
1214 VarInstance
1215 | TimerInstance
1216 | ConstDef
1217 | TemplateDef
1218 ;
1219
1220 AltstepInstance:
1221 Identifier '(' optFunctionActualParList ')'
1222 | Identifier Dot Identifier '(' optFunctionActualParList ')'
1223 | Identifier Dot ObjectIdentifierValue Dot Identifier
1224 '(' optFunctionActualParList ')'
1225 ;
1226
1227 AltstepRef:
1228 Identifier
1229 | Identifier Dot Identifier
1230 | Identifier Dot ObjectIdentifierValue Dot Identifier
1231 ;
1232
1233 /* A.1.6.1.8 Import definitions */
1234
1235 ImportDef:
1236 ImportKeyword ImportFromSpec AllWithExcepts
1237 | ImportKeyword ImportFromSpec '{' ImportSpec '}'
1238 ;
1239
1240 AllWithExcepts:
1241 AllKeyword
1242 | AllKeyword ExceptsDef
1243 ;
1244
1245 ExceptsDef:
1246 ExceptKeyword '{' ExceptSpec '}'
1247 ;
1248
1249 ExceptSpec:
1250 /* empty */
1251 | ExceptSpec ExceptElement optSemiColon
1252 ;
1253
1254 ExceptElement:
1255 ExceptGroupSpec
1256 | ExceptTypeDefSpec
1257 | ExceptTemplateSpec
1258 | ExceptConstSpec
1259 | ExceptTestcaseSpec
1260 | ExceptAltstepSpec
1261 | ExceptFunctionSpec
1262 | ExceptSignatureSpec
1263 | ExceptModuleParSpec
1264 ;
1265
1266 ExceptGroupSpec:
1267 GroupKeyword ExceptGroupRefList
1268 | GroupKeyword AllKeyword
1269 ;
1270
1271 ExceptTypeDefSpec:
1272 TypeDefKeyword TypeRefList
1273 | TypeDefKeyword AllKeyword
1274 ;
1275
1276 ExceptTemplateSpec:
1277 TemplateKeyword TemplateRefList
1278 | TemplateKeyword AllKeyword
1279 ;
1280
1281 ExceptConstSpec:
1282 ConstKeyword ConstRefList
1283 | ConstKeyword AllKeyword
1284 ;
1285
1286 ExceptTestcaseSpec:
1287 TestcaseKeyword TestcaseRefList
1288 | TestcaseKeyword AllKeyword
1289 ;
1290
1291 ExceptAltstepSpec:
1292 AltstepKeyword AltstepRefList
1293 | AltstepKeyword AllKeyword
1294 ;
1295
1296 ExceptFunctionSpec:
1297 FunctionKeyword FunctionRefList
1298 | FunctionKeyword AllKeyword
1299 ;
1300
1301 ExceptSignatureSpec:
1302 SignatureKeyword SignatureRefList
1303 | SignatureKeyword AllKeyword
1304 ;
1305
1306 ExceptModuleParSpec:
1307 ModuleParKeyword ModuleParRefList
1308 | ModuleParKeyword AllKeyword
1309 ;
1310
1311 ImportSpec:
1312 /* empty */
1313 | ImportSpec ImportElement optSemiColon
1314 ;
1315
1316 ImportElement:
1317 ImportGroupSpec
1318 | ImportTypeDefSpec
1319 | ImportTemplateSpec
1320 | ImportConstSpec
1321 | ImportTestcaseSpec
1322 | ImportAltstepSpec
1323 | ImportFunctionSpec
1324 | ImportSignatureSpec
1325 | ImportModuleParSpec
1326 ;
1327
1328 ImportFromSpec:
1329 FromKeyword ModuleId
1330 | FromKeyword ModuleId RecursiveKeyword
1331 ;
1332
1333 ImportGroupSpec:
1334 GroupKeyword GroupRefListWithExcept
1335 | GroupKeyword AllGroupsWithExcept
1336 ;
1337
1338 GroupRefList:
1339 FullGroupIdentifier
1340 | GroupRefList ',' FullGroupIdentifier
1341 ;
1342
1343 GroupRefListWithExcept:
1344 FullGroupIdentifierWithExcept
1345 | GroupRefListWithExcept ',' FullGroupIdentifierWithExcept
1346 ;
1347
1348 AllGroupsWithExcept:
1349 AllKeyword
1350 | AllKeyword ExceptKeyword GroupRefList
1351 ;
1352
1353 FullGroupIdentifier:
1354 Identifier
1355 | FullGroupIdentifier Dot Identifier
1356 ;
1357
1358 FullGroupIdentifierWithExcept:
1359 FullGroupIdentifier
1360 | FullGroupIdentifier ExceptsDef
1361 ;
1362
1363 ExceptGroupRefList:
1364 ExceptFullGroupIdentifier
1365 | ExceptGroupRefList ',' ExceptFullGroupIdentifier
1366 ;
1367
1368 ExceptFullGroupIdentifier:
1369 FullGroupIdentifier
1370 ;
1371
1372 ImportTypeDefSpec:
1373 TypeDefKeyword TypeRefList
1374 | TypeDefKeyword AllTypesWithExcept
1375 ;
1376
1377 TypeRefList:
1378 Identifier
1379 | TypeRefList ',' Identifier
1380 ;
1381
1382 AllTypesWithExcept:
1383 AllKeyword
1384 | AllKeyword ExceptKeyword TypeRefList
1385 ;
1386
1387 ImportTemplateSpec:
1388 TemplateKeyword TemplateRefList
1389 | TemplateKeyword AllTemplsWithExcept
1390 ;
1391
1392 TemplateRefList:
1393 Identifier
1394 | TemplateRefList ',' Identifier
1395 ;
1396
1397 AllTemplsWithExcept:
1398 AllKeyword
1399 | AllKeyword ExceptKeyword TemplateRefList
1400 ;
1401
1402 ImportConstSpec:
1403 ConstKeyword ConstRefList
1404 | ConstKeyword AllConstsWithExcept
1405 ;
1406
1407 ConstRefList:
1408 Identifier
1409 | ConstRefList ',' Identifier
1410 ;
1411
1412 AllConstsWithExcept:
1413 AllKeyword
1414 | AllKeyword ExceptKeyword ConstRefList
1415 ;
1416
1417 ImportAltstepSpec:
1418 AltstepKeyword AltstepRefList
1419 | AltstepKeyword AllAltstepsWithExcept
1420 ;
1421
1422 AltstepRefList:
1423 Identifier
1424 | AltstepRefList ',' Identifier
1425 ;
1426
1427 AllAltstepsWithExcept:
1428 AllKeyword
1429 | AllKeyword ExceptKeyword AltstepRefList
1430 ;
1431
1432 ImportTestcaseSpec:
1433 TestcaseKeyword TestcaseRefList
1434 | TestcaseKeyword AllTestcasesWithExcept
1435 ;
1436
1437 TestcaseRefList:
1438 Identifier
1439 | TestcaseRefList ',' Identifier
1440 ;
1441
1442 AllTestcasesWithExcept:
1443 AllKeyword
1444 | AllKeyword ExceptKeyword TestcaseRefList
1445 ;
1446
1447 ImportFunctionSpec:
1448 FunctionKeyword FunctionRefList
1449 | FunctionKeyword AllFunctionsWithExcept
1450 ;
1451
1452 FunctionRefList:
1453 Identifier
1454 | FunctionRefList ',' Identifier
1455 ;
1456
1457 AllFunctionsWithExcept:
1458 AllKeyword
1459 | AllKeyword ExceptKeyword FunctionRefList
1460 ;
1461
1462 ImportSignatureSpec:
1463 SignatureKeyword SignatureRefList
1464 | SignatureKeyword AllSignaturesWithExcept
1465 ;
1466
1467 SignatureRefList:
1468 Identifier
1469 | SignatureRefList ',' Identifier
1470 ;
1471
1472 AllSignaturesWithExcept:
1473 AllKeyword
1474 | AllKeyword ExceptKeyword SignatureRefList
1475 ;
1476
1477 ImportModuleParSpec:
1478 ModuleParKeyword ModuleParRefList
1479 | ModuleParKeyword AllModuleParWithExcept
1480 ;
1481
1482 ModuleParRefList:
1483 Identifier
1484 | ModuleParRefList ',' Identifier
1485 ;
1486
1487 AllModuleParWithExcept:
1488 AllKeyword
1489 | AllKeyword ExceptKeyword ModuleParRefList
1490 ;
1491
1492 /* A.1.6.1.9 Group definitions */
1493
1494 GroupDef:
1495 GroupKeyword Identifier
1496 '{' optModuleDefinitionsPart '}'
1497 ;
1498
1499 /* A.1.6.1.10 External function definitions */
1500
1501 ExtFunctionDef:
1502 ExtKeyword FunctionKeyword Identifier
1503 '(' optFunctionFormalParList ')' optReturnType
1504 ;
1505
1506 /* A.1.6.1.11 External constant definitions */
1507
1508 ExtConstDef:
1509 ExtKeyword ConstKeyword Type Identifier
1510 ;
1511
1512 /* A.1.6.1.12 Module parameter definitions */
1513
1514 ModuleParDef:
1515 ModuleParKeyword ModulePar
1516 | ModuleParKeyword '{' MultitypedModuleParList '}'
1517 ;
1518
1519 MultitypedModuleParList:
1520 ModulePar SemiColon
1521 | MultitypedModuleParList ModulePar SemiColon
1522 ;
1523
1524 ModulePar:
1525 Type ModuleParList
1526 ;
1527
1528 ModuleParList:
1529 SingleModulePar
1530 | ModuleParList ',' SingleModulePar
1531 ;
1532
1533 SingleModulePar:
1534 Identifier
1535 | Identifier AssignmentChar Expression
1536 ;
1537
1538 /* A.1.6.2 Control part */
1539
1540 /* A.1.6.2.0 General */
1541
1542 optModuleControlPart:
1543 /* empty */
1544 | ModuleControlPart
1545 ;
1546
1547 ModuleControlPart:
1548 ControlKeyword
1549 '{' ModuleControlBody '}'
1550 optWithStatementAndSemiColon
1551 ;
1552
1553 ModuleControlBody:
1554 /* empty */
1555 | ControlStatementOrDefList
1556 ;
1557
1558 ControlStatementOrDefList:
1559 ControlStatementOrDef optSemiColon
1560 | ControlStatementOrDefList ControlStatementOrDef optSemiColon
1561 ;
1562
1563 ControlStatementOrDef:
1564 FunctionLocalDef
1565 | FunctionLocalInst
1566 | ControlStatement
1567 ;
1568
1569 ControlStatement:
1570 TimerStatements
1571 | BasicStatements
1572 | BehaviourStatements
1573 | SUTStatements
1574 | StopKeyword
1575 ;
1576
1577 /* A.1.6.2.1 Variable instantiation */
1578
1579 VarInstance:
1580 VarKeyword Type VarList
1581 | VarKeyword TemplateKeyword Type TempVarList
1582 ;
1583
1584 VarList:
1585 SingleVarInstance
1586 | VarList ',' SingleVarInstance
1587 ;
1588
1589 SingleVarInstance:
1590 Identifier optArrayDef
1591 | Identifier optArrayDef AssignmentChar VarInitialValue
1592 ;
1593
1594 VarInitialValue:
1595 Expression
1596 ;
1597
1598 TempVarList:
1599 SingleTempVarInstance
1600 | TempVarList ',' SingleTempVarInstance
1601 ;
1602
1603 SingleTempVarInstance:
1604 Identifier optArrayDef
1605 | Identifier optArrayDef AssignmentChar TempVarInitialValue
1606 ;
1607
1608 TempVarInitialValue:
1609 TemplateBody
1610 ;
1611
1612 VariableRef:
1613 Reference
1614 ;
1615
1616 /* A.1.6.2.2 Timer instantiation */
1617
1618 TimerInstance:
1619 TimerKeyword TimerList
1620 ;
1621
1622 TimerList:
1623 SingleTimerInstance
1624 | TimerList ',' SingleTimerInstance
1625 ;
1626
1627 SingleTimerInstance:
1628 Identifier optArrayDef
1629 | Identifier optArrayDef AssignmentChar TimerValue
1630 ;
1631
1632 TimerValue:
1633 Expression
1634 ;
1635
1636 TimerRef:
1637 VariableRef
1638 ;
1639
1640 /* A.1.6.2.3 Component operations */
1641
1642 ConfigurationStatements:
1643 ConnectStatement
1644 | MapStatement
1645 | DisconnectStatement
1646 | UnmapStatement
1647 | DoneStatement
1648 | KilledStatement
1649 | StartTCStatement
1650 | StopTCStatement
1651 | KillTCStatement
1652 ;
1653
1654 ConfigurationOps:
1655 CreateOp
1656 | SelfOp
1657 | SystemOp
1658 | MTCOp
1659 | RunningOp
1660 | AliveOp
1661 ;
1662
1663 CreateOp:
1664 VariableRef DotCreateKeyword optAliveKeyword
1665 | VariableRef DotCreateKeyword '(' SingleExpression ')' optAliveKeyword
1666 ;
1667
1668 optAliveKeyword:
1669 /* empty */
1670 | AliveKeyword
1671 ;
1672
1673 SystemOp:
1674 SystemKeyword
1675 ;
1676
1677 MTCOp:
1678 MTCKeyword
1679 ;
1680
1681 DoneStatement:
1682 ComponentId DotDoneKeyword
1683 ;
1684
1685 KilledStatement:
1686 ComponentId DotKilledKeyword
1687 ;
1688
1689 ComponentId:
1690 ComponentOrDefaultReference
1691 | AnyKeyword ComponentKeyword
1692 | AllKeyword ComponentKeyword
1693 ;
1694
1695 RunningOp:
1696 /* VariableRef DotRunningKeyword -- covered by RunningTimerOp */
1697 FunctionInstance DotRunningKeyword
1698 | AnyKeyword ComponentKeyword DotRunningKeyword
1699 | AllKeyword ComponentKeyword DotRunningKeyword
1700 ;
1701
1702 AliveOp:
1703 ComponentId DotAliveKeyword
1704 ;
1705
1706 ConnectStatement:
1707 ConnectKeyword SingleConnectionSpec
1708 ;
1709
1710 SingleConnectionSpec:
1711 '(' PortRef ',' PortRef ')'
1712 ;
1713
1714 PortRef:
1715 ComponentRef Colon Port
1716 ;
1717
1718 ComponentRef:
1719 ComponentOrDefaultReference
1720 | SystemOp
1721 | SelfOp
1722 | MTCOp
1723 ;
1724
1725 DisconnectStatement:
1726 DisconnectKeyword optSingleOrMultiConnectionSpec
1727 ;
1728
1729 optSingleOrMultiConnectionSpec:
1730 /* empty */
1731 | SingleConnectionSpec
1732 | AllConnectionsSpec
1733 | AllPortsSpec
1734 | AllCompsAllPortsSpec
1735 ;
1736
1737 AllConnectionsSpec:
1738 '(' PortRef ')'
1739 ;
1740
1741 AllPortsSpec:
1742 '(' ComponentRef ':' AllKeyword PortKeyword ')'
1743 ;
1744
1745 AllCompsAllPortsSpec:
1746 '(' AllKeyword ComponentKeyword ':' AllKeyword PortKeyword ')'
1747 ;
1748
1749 MapStatement:
1750 MapKeyword SingleConnectionSpec
1751 ;
1752
1753 UnmapStatement:
1754 UnmapKeyword optSingleOrMultiConnectionSpec
1755 ;
1756
1757 StartTCStatement:
1758 /* VariableRef DotStartKeyword '(' FunctionInstance ')'
1759 -- covered by StartTimerStatement */
1760 FunctionInstance DotStartKeyword '(' FunctionInstance ')'
1761 ;
1762
1763 StopTCStatement:
1764 StopKeyword
1765 /* | VariableRef DotStopKeyword -- covered by StopTimerStatement */
1766 | FunctionInstance DotStopKeyword
1767 | MTCOp DotStopKeyword
1768 | SelfOp DotStopKeyword
1769 | AllKeyword ComponentKeyword DotStopKeyword
1770 ;
1771
1772 ComponentReferenceOrLiteral:
1773 ComponentOrDefaultReference
1774 | MTCOp
1775 | SelfOp
1776 ;
1777
1778 KillTCStatement:
1779 KillKeyword
1780 | ComponentReferenceOrLiteral DotKillKeyword
1781 | AllKeyword ComponentKeyword DotKillKeyword
1782 ;
1783
1784 ComponentOrDefaultReference:
1785 VariableRef
1786 | FunctionInstance
1787 ;
1788
1789 /* A.1.6.2.4 Port operations */
1790
1791 Port:
1792 VariableRef
1793 ;
1794
1795 CommunicationStatements:
1796 SendStatement
1797 | CallStatement
1798 | ReplyStatement
1799 | RaiseStatement
1800 | ReceiveStatement
1801 | TriggerStatement
1802 | GetCallStatement
1803 | GetReplyStatement
1804 | CatchStatement
1805 | CheckStatement
1806 | ClearStatement
1807 | StartStatement
1808 | StopStatement
1809 ;
1810
1811 SendStatement:
1812 Port DotSendOpKeyword PortSendOp
1813 ;
1814
1815 PortSendOp:
1816 '(' SendParameter ')' optToClause
1817 ;
1818
1819 SendParameter:
1820 TemplateInstance
1821 ;
1822
1823 optToClause:
1824 /* empty */
1825 | ToKeyword AddressRef
1826 /* | ToKeyword AddressRefList -- covered by the previous rule
1827 (as ValueOrAttribList) */
1828 | ToKeyword AllKeyword ComponentKeyword
1829 ;
1830
1831 AddressRefList:
1832 '(' seqAddressRef ')'
1833 ;
1834
1835 seqAddressRef:
1836 AddressRef
1837 | seqAddressRef ',' AddressRef
1838 ;
1839
1840 AddressRef:
1841 TemplateInstance
1842 ;
1843
1844 CallStatement:
1845 Port DotCallOpKeyword PortCallOp optPortCallBody
1846 ;
1847
1848 PortCallOp:
1849 '(' CallParameters ')' optToClause
1850 ;
1851
1852 CallParameters:
1853 TemplateInstance
1854 | TemplateInstance ',' CallTimerValue
1855 ;
1856
1857 CallTimerValue:
1858 TimerValue
1859 | NowaitKeyword
1860 ;
1861
1862 optPortCallBody:
1863 /* empty */
1864 | '{' CallBodyStatementList '}'
1865 ;
1866
1867 CallBodyStatementList:
1868 CallBodyStatement optSemiColon
1869 | CallBodyStatementList CallBodyStatement optSemiColon
1870 ;
1871
1872 CallBodyStatement:
1873 CallBodyGuard StatementBlock
1874 ;
1875
1876 CallBodyGuard:
1877 AltGuardChar CallBodyOps
1878 ;
1879
1880 CallBodyOps:
1881 GetReplyStatement
1882 | CatchStatement
1883 ;
1884
1885 ReplyStatement:
1886 Port DotReplyKeyword PortReplyOp
1887 ;
1888
1889 PortReplyOp:
1890 '(' TemplateInstance optReplyValue ')' optToClause
1891 ;
1892
1893 optReplyValue:
1894 /* empty */
1895 | ValueKeyword Expression
1896 ;
1897
1898 RaiseStatement:
1899 Port DotRaiseKeyword PortRaiseOp
1900 ;
1901
1902 PortRaiseOp:
1903 '(' Signature ',' TemplateInstance ')' optToClause
1904 ;
1905
1906 ReceiveStatement:
1907 PortOrAny DotReceiveOpKeyword PortReceiveOp
1908 ;
1909
1910 PortOrAny:
1911 Port
1912 | AnyKeyword PortKeyword
1913 ;
1914
1915 PortReceiveOp:
1916 optReceiveParameter optFromClause optPortRedirect
1917 ;
1918
1919 optReceiveParameter:
1920 /* empty */
1921 | '(' ReceiveParameter ')'
1922 ;
1923
1924 ReceiveParameter:
1925 TemplateInstance
1926 ;
1927
1928 optFromClause:
1929 /* empty */
1930 | FromClause
1931 ;
1932
1933 FromClause:
1934 FromKeyword AddressRef
1935 ;
1936
1937 optPortRedirect:
1938 /* empty */
1939 | PortRedirectSymbol ValueSpec
1940 | PortRedirectSymbol SenderSpec
1941 | PortRedirectSymbol ValueSpec SenderSpec
1942 ;
1943
1944 ValueSpec:
1945 ValueKeyword VariableRef
1946 ;
1947
1948 SenderSpec:
1949 SenderKeyword VariableRef
1950 ;
1951
1952 TriggerStatement:
1953 PortOrAny DotTriggerOpKeyword PortTriggerOp
1954 ;
1955
1956 PortTriggerOp:
1957 optReceiveParameter optFromClause optPortRedirect
1958 ;
1959
1960 GetCallStatement:
1961 PortOrAny DotGetCallOpKeyword PortGetCallOp
1962 ;
1963
1964 PortGetCallOp:
1965 optReceiveParameter optFromClause optPortRedirectWithParam
1966 ;
1967
1968 optPortRedirectWithParam:
1969 /* empty */
1970 | PortRedirectSymbol RedirectWithParamSpec
1971 ;
1972
1973 RedirectWithParamSpec:
1974 ParamSpec
1975 | ParamSpec SenderSpec
1976 | SenderSpec
1977 ;
1978
1979 ParamSpec:
1980 ParamKeyword ParamAssignmentList
1981 ;
1982
1983 ParamAssignmentList:
1984 '(' AssignmentList ')'
1985 | '(' VariableList ')'
1986 ;
1987
1988 AssignmentList:
1989 VariableAssignment
1990 | AssignmentList ',' VariableAssignment
1991 ;
1992
1993 VariableAssignment:
1994 VariableRef AssignmentChar Identifier
1995 ;
1996
1997 VariableList:
1998 VariableEntry
1999 | VariableList ',' VariableEntry
2000 ;
2001
2002 VariableEntry:
2003 VariableRef
2004 | NotUsedSymbol
2005 ;
2006
2007 GetReplyStatement:
2008 PortOrAny DotGetReplyOpKeyword PortGetReplyOp
2009 ;
2010
2011 PortGetReplyOp:
2012 optGetReplyParameter optFromClause
2013 optPortRedirectWithValueAndParam
2014 ;
2015
2016 optPortRedirectWithValueAndParam:
2017 /* empty */
2018 | PortRedirectSymbol RedirectWithValueAndParamSpec
2019 ;
2020
2021 RedirectWithValueAndParamSpec:
2022 ValueSpec
2023 | ValueSpec ParamSpec
2024 | ValueSpec SenderSpec
2025 | ValueSpec ParamSpec SenderSpec
2026 | RedirectWithParamSpec
2027 ;
2028
2029 optGetReplyParameter:
2030 /* empty */
2031 | '(' ReceiveParameter ')'
2032 | '(' ReceiveParameter ValueMatchSpec ')'
2033 ;
2034
2035 ValueMatchSpec:
2036 ValueKeyword TemplateInstance
2037 ;
2038
2039 CheckStatement:
2040 PortOrAny DotCheckOpKeyword optCheckParameter
2041 ;
2042
2043 optCheckParameter:
2044 /* empty */
2045 | '(' CheckParameter ')'
2046 ;
2047
2048 CheckParameter:
2049 CheckPortOpsPresent
2050 | FromClausePresent
2051 | RedirectPresent
2052 ;
2053
2054 FromClausePresent:
2055 FromClause
2056 | FromClause PortRedirectSymbol SenderSpec
2057 ;
2058
2059 RedirectPresent:
2060 PortRedirectSymbol SenderSpec
2061 ;
2062
2063 CheckPortOpsPresent:
2064 ReceiveOpKeyword PortReceiveOp
2065 | GetCallOpKeyword PortGetCallOp
2066 | GetReplyOpKeyword PortGetReplyOp
2067 | CatchOpKeyword PortCatchOp
2068 ;
2069
2070 CatchStatement:
2071 PortOrAny DotCatchOpKeyword PortCatchOp
2072 ;
2073
2074 PortCatchOp:
2075 optCatchOpParameter optFromClause optPortRedirect
2076 ;
2077
2078 optCatchOpParameter:
2079 /* empty */
2080 | '(' CatchOpParameter ')'
2081 ;
2082
2083 CatchOpParameter:
2084 Signature ',' TemplateInstance
2085 | TimeoutKeyword
2086 ;
2087
2088 ClearStatement:
2089 PortOrAll DotClearOpKeyword
2090 ;
2091
2092 PortOrAll:
2093 Port
2094 | AllKeyword PortKeyword
2095 ;
2096
2097 StartStatement:
2098 /* Port DotPortStartKeyword -- covered by StartTimerStatement */
2099 AllKeyword PortKeyword DotStartKeyword
2100 ;
2101
2102 StopStatement:
2103 /* Port DotPortStopKeyword -- covered by StopTimerStatement */
2104 AllKeyword PortKeyword DotStopKeyword
2105 ;
2106
2107 /* A.1.6.2.5 Timer operations */
2108
2109 TimerStatements:
2110 StartTimerStatement
2111 | StopTimerStatement
2112 | TimeoutStatement
2113 ;
2114
2115 TimerOps:
2116 ReadTimerOp
2117 | RunningTimerOp
2118 ;
2119
2120 StartTimerStatement:
2121 TimerRef DotStartKeyword optTimerValue
2122 ;
2123
2124 optTimerValue:
2125 /* empty */
2126 | '(' TimerValue ')'
2127 ;
2128
2129 StopTimerStatement:
2130 TimerRefOrAll DotStopKeyword
2131 ;
2132
2133 TimerRefOrAll:
2134 TimerRef
2135 | AllKeyword TimerKeyword
2136 ;
2137
2138 ReadTimerOp:
2139 TimerRef DotReadKeyword
2140 ;
2141
2142 RunningTimerOp:
2143 TimerRefOrAny DotRunningKeyword
2144 ;
2145
2146 TimeoutStatement:
2147 TimerRefOrAny DotTimeoutKeyword
2148 ;
2149
2150 TimerRefOrAny:
2151 TimerRef
2152 | AnyKeyword TimerKeyword
2153 ;
2154
2155 /* A.1.6.3 Type */
2156
2157 Type:
2158 PredefinedType
2159 | ReferencedType
2160 ;
2161
2162 PredefinedType:
2163 BitStringKeyword
2164 | BooleanKeyword
2165 | CharStringKeyword
2166 | UniversalCharString
2167 | IntegerKeyword
2168 | OctetStringKeyword
2169 | HexStringKeyword
2170 | VerdictTypeKeyword
2171 | FloatKeyword
2172 | AddressKeyword
2173 | DefaultKeyword
2174 | AnyTypeKeyword
2175 | ObjectIdentifierKeyword
2176 ;
2177
2178 UniversalCharString:
2179 UniversalKeyword CharStringKeyword
2180 ;
2181
2182 ReferencedType:
2183 Reference
2184 | FunctionInstance optExtendedFieldReference
2185 /* covers all parameterized type references */
2186 ;
2187
2188 TypeReference:
2189 Identifier
2190 | Identifier TypeActualParList
2191 ;
2192
2193 TypeActualParList:
2194 '(' seqTypeActualPar ')'
2195 ;
2196
2197 seqTypeActualPar:
2198 TypeActualPar
2199 | seqTypeActualPar ',' TypeActualPar
2200 ;
2201
2202 TypeActualPar:
2203 Expression
2204 ;
2205
2206 optArrayDef:
2207 /* empty */
2208 | optArrayDef ArrayIndex
2209 ;
2210
2211 ArrayIndex:
2212 '[' ArrayBounds ']'
2213 | '[' ArrayBounds DotDot ArrayBounds ']'
2214 ;
2215
2216 ArrayBounds:
2217 SingleExpression
2218 ;
2219
2220 /* A.1.6.4 Value */
2221
2222 Value:
2223 PredefinedValue
2224 | ReferencedValue
2225 ;
2226
2227 PredefinedValue:
2228 BitStringValue
2229 | BooleanValue
2230 | CharStringValue
2231 | IntegerValue
2232 | OctetStringValue
2233 | HexStringValue
2234 | VerdictTypeValue
2235 /* | EnumeratedValue -- covered by ReferencedValue */
2236 | FloatValue
2237 | AddressValue
2238 | OmitValue
2239 | ObjectIdentifierValue
2240 ;
2241
2242 BitStringValue:
2243 Bstring
2244 ;
2245
2246 BooleanValue:
2247 BooleanConst
2248 ;
2249
2250 IntegerValue:
2251 Number
2252 ;
2253
2254 OctetStringValue:
2255 Ostring
2256 ;
2257
2258 HexStringValue:
2259 Hstring
2260 ;
2261
2262 VerdictTypeValue:
2263 VerdictConst
2264 ;
2265
2266 CharStringValue:
2267 Cstring
2268 | Quadruple
2269 ;
2270
2271 Quadruple:
2272 CharKeyword '(' Group ',' Plane ',' Row ',' Cell ')'
2273 ;
2274
2275 Group:
2276 Number
2277 ;
2278
2279 Plane:
2280 Number
2281 ;
2282
2283 Row:
2284 Number
2285 ;
2286
2287 Cell:
2288 Number
2289 ;
2290
2291 ReferencedValue:
2292 Reference
2293 ;
2294
2295 Reference:
2296 Identifier
2297 | Identifier Dot Identifier optExtendedFieldReference
2298 | Identifier Dot PredefinedType optExtendedFieldReference
2299 | Identifier ArrayOrBitRef optExtendedFieldReference
2300 | Identifier Dot ObjectIdentifierValue Dot Identifier
2301 optExtendedFieldReference
2302 ;
2303
2304 FreeText:
2305 Cstring
2306 ;
2307
2308 AddressValue:
2309 NullKeyword
2310 ;
2311
2312 OmitValue:
2313 OmitKeyword
2314 ;
2315
2316 /* A.1.6.5 Parameterization */
2317
2318 FormalValuePar:
2319 Type Identifier
2320 | InParKeyword Type Identifier
2321 | InOutParKeyword Type Identifier
2322 | OutParKeyword Type Identifier
2323 ;
2324
2325 FormalPortPar:
2326 Identifier Identifier
2327 | InOutParKeyword Identifier Identifier
2328 ;
2329
2330 FormalTimerPar:
2331 TimerKeyword Identifier
2332 | InOutParKeyword TimerKeyword Identifier
2333 ;
2334
2335 FormalTemplatePar:
2336 TemplateKeyword Type Identifier
2337 | InParKeyword TemplateKeyword Type Identifier
2338 | InOutParKeyword TemplateKeyword Type Identifier
2339 | OutParKeyword TemplateKeyword Type Identifier
2340 ;
2341
2342 /* A.1.6.6 With statement */
2343
2344 optWithStatement:
2345 /* empty */
2346 | WithStatement
2347 ;
2348
2349 optWithStatementAndSemiColon:
2350 /* empty */
2351 | WithStatement
2352 | SemiColon
2353 | WithStatement SemiColon
2354 ;
2355
2356 WithStatement:
2357 WithKeyword WithAttribList
2358 ;
2359
2360 WithAttribList:
2361 '{' MultiWithAttrib '}'
2362 ;
2363
2364 MultiWithAttrib:
2365 SingleWithAttrib optSemiColon
2366 | MultiWithAttrib SingleWithAttrib optSemiColon
2367 ;
2368
2369 SingleWithAttrib:
2370 AttribKeyword optOverrideKeyword optAttribQualifier AttribSpec
2371 ;
2372
2373 AttribKeyword:
2374 EncodeKeyword
2375 | VariantKeyword
2376 | DisplayKeyword
2377 | ExtensionKeyword
2378 ;
2379
2380 optOverrideKeyword:
2381 /* empty */
2382 | OverrideKeyword
2383 ;
2384
2385 optAttribQualifier:
2386 /* empty */
2387 | '(' DefOrFieldRefList ')'
2388 ;
2389
2390 DefOrFieldRefList:
2391 DefOrFieldRef
2392 | DefOrFieldRefList ',' DefOrFieldRef
2393 ;
2394
2395 DefOrFieldRef:
2396 DefinitionRef
2397 | FieldReference
2398 | AllRef
2399 ;
2400
2401 DefinitionRef:
2402 /* other alternatives are covered by FieldReference */
2403 Identifier Dot FullGroupIdentifier
2404 ;
2405
2406 AllRef:
2407 GroupKeyword AllKeyword
2408 | GroupKeyword AllKeyword ExceptKeyword '{' GroupRefList '}'
2409 | TypeDefKeyword AllKeyword
2410 | TypeDefKeyword AllKeyword ExceptKeyword '{' TypeRefList '}'
2411 | TemplateKeyword AllKeyword
2412 | TemplateKeyword AllKeyword ExceptKeyword '{' TemplateRefList '}'
2413 | ConstKeyword AllKeyword
2414 | ConstKeyword AllKeyword ExceptKeyword '{' ConstRefList '}'
2415 | AltstepKeyword AllKeyword
2416 | AltstepKeyword AllKeyword ExceptKeyword '{' AltstepRefList '}'
2417 | TestcaseKeyword AllKeyword
2418 | TestcaseKeyword AllKeyword ExceptKeyword '{' TestcaseRefList '}'
2419 | FunctionKeyword AllKeyword
2420 | FunctionKeyword AllKeyword ExceptKeyword '{' FunctionRefList '}'
2421 | SignatureKeyword AllKeyword
2422 | SignatureKeyword AllKeyword ExceptKeyword '{' SignatureRefList '}'
2423 | ModuleParKeyword AllKeyword
2424 | ModuleParKeyword AllKeyword ExceptKeyword '{' ModuleParRefList '}'
2425 ;
2426
2427 AttribSpec:
2428 FreeText
2429 ;
2430
2431 /* A.1.6.7 Behaviour statements */
2432
2433 BehaviourStatements:
2434 TestcaseInstance
2435 | FunctionInstance
2436 | ReturnStatement
2437 | AltConstruct
2438 | InterleavedConstruct
2439 | LabelStatement
2440 | GotoStatement
2441 | RepeatStatement
2442 | DeactivateStatement
2443 /* | AltstepInstance -- covered by FunctionInstance */
2444 | ActivateOp
2445 ;
2446
2447 VerdictStatements:
2448 SetLocalVerdict
2449 ;
2450
2451 VerdictOps:
2452 GetLocalVerdict
2453 ;
2454
2455 SetLocalVerdict:
2456 SetVerdictKeyword '(' SingleExpression ')'
2457 ;
2458
2459 GetLocalVerdict:
2460 GetVerdictKeyword
2461 ;
2462
2463 SUTStatements:
2464 ActionKeyword '(' ')'
2465 | ActionKeyword '(' seqActionText ')'
2466 ;
2467
2468 seqActionText:
2469 ActionText
2470 /* | seqActionText StringOp ActionText -- covered by the previous rule */
2471 ;
2472
2473 ActionText:
2474 /* FreeText -- covered by the next rule */
2475 Expression
2476 ;
2477
2478 ReturnStatement:
2479 ReturnKeyword
2480 | ReturnKeyword Expression
2481 ;
2482
2483 AltConstruct:
2484 AltKeyword '{' AltGuardList '}'
2485 ;
2486
2487 AltGuardList:
2488 AltGuard
2489 | AltGuardList AltGuard
2490 ;
2491
2492 AltGuard:
2493 GuardStatement
2494 | ElseStatement optSemiColon
2495 ;
2496
2497 GuardStatement:
2498 AltGuardChar AltstepInstance
2499 | AltGuardChar AltstepInstance StatementBlock
2500 | AltGuardChar GuardOp StatementBlock
2501 ;
2502
2503 ElseStatement:
2504 '[' ElseKeyword ']' StatementBlock
2505 ;
2506
2507 AltGuardChar:
2508 '[' ']'
2509 | '[' BooleanExpression ']'
2510 ;
2511
2512 GuardOp:
2513 TimeoutStatement
2514 | ReceiveStatement
2515 | TriggerStatement
2516 | GetCallStatement
2517 | CatchStatement
2518 | CheckStatement
2519 | GetReplyStatement
2520 | DoneStatement
2521 | KilledStatement
2522 ;
2523
2524 InterleavedConstruct:
2525 InterleavedKeyword '{' InterleavedGuardList '}'
2526 ;
2527
2528 InterleavedGuardList:
2529 InterleavedGuardElement optSemiColon
2530 | InterleavedGuardList InterleavedGuardElement optSemiColon
2531 ;
2532
2533 InterleavedGuardElement:
2534 InterleavedGuard InterleavedAction
2535 ;
2536
2537 InterleavedGuard:
2538 '[' ']' GuardOp
2539 ;
2540
2541 InterleavedAction:
2542 StatementBlock
2543 ;
2544
2545 LabelStatement:
2546 LabelKeyword Identifier
2547 ;
2548
2549 GotoStatement:
2550 GotoKeyword Identifier
2551 ;
2552
2553 RepeatStatement:
2554 RepeatKeyword
2555 ;
2556
2557 ActivateOp:
2558 ActivateKeyword '(' AltstepInstance ')'
2559 ;
2560
2561 DeactivateStatement:
2562 DeactivateKeyword
2563 | DeactivateKeyword '(' ComponentOrDefaultReference ')'
2564 ;
2565
2566 /* A.1.6.8 Basic statements */
2567
2568 BasicStatements:
2569 Assignment
2570 | LogStatement
2571 | LoopConstruct
2572 | ConditionalConstruct
2573 | SelectCaseConstruct
2574 ;
2575
2576 Expression:
2577 SingleExpression
2578 | CompoundExpression
2579 ;
2580
2581 CompoundExpression:
2582 FieldExpressionList
2583 | ArrayExpression
2584 ;
2585
2586 FieldExpressionList:
2587 '{' seqFieldExpressionSpec '}'
2588 ;
2589
2590 seqFieldExpressionSpec:
2591 FieldExpressionSpec
2592 | seqFieldExpressionSpec ',' FieldExpressionSpec
2593 ;
2594
2595 FieldExpressionSpec:
2596 FieldReference AssignmentChar NotUsedOrExpression
2597 ;
2598
2599 ArrayExpression:
2600 '{' '}'
2601 | '{' ArrayElementExpressionList '}'
2602 ;
2603
2604 ArrayElementExpressionList:
2605 NotUsedOrExpression
2606 | ArrayElementExpressionList ',' NotUsedOrExpression
2607 ;
2608
2609 NotUsedOrExpression:
2610 Expression
2611 | NotUsedSymbol
2612 ;
2613
2614 BooleanExpression:
2615 SingleExpression
2616 ;
2617
2618 Assignment:
2619 /* VariableRef AssignmentChar Expression -- covered by the next rule */
2620 VariableRef AssignmentChar TemplateBody
2621 ;
2622
2623 SingleExpression:
2624 XorExpression
2625 | SingleExpression Or XorExpression
2626 ;
2627
2628 XorExpression:
2629 AndExpression
2630 | XorExpression Xor AndExpression
2631 ;
2632
2633 AndExpression:
2634 NotExpression
2635 | AndExpression And NotExpression
2636 ;
2637
2638 NotExpression:
2639 EqualExpression
2640 | Not EqualExpression
2641 ;
2642
2643 EqualExpression:
2644 RelExpression
2645 | EqualExpression EqualOp RelExpression
2646 ;
2647
2648 RelExpression:
2649 ShiftExpression
2650 | ShiftExpression RelOp ShiftExpression
2651 ;
2652
2653 ShiftExpression:
2654 BitOrExpression
2655 | ShiftExpression ShiftOp BitOrExpression
2656 ;
2657
2658 BitOrExpression:
2659 BitXorExpression
2660 | BitOrExpression Or4b BitXorExpression
2661 ;
2662
2663 BitXorExpression:
2664 BitAndExpression
2665 | BitXorExpression Xor4b BitAndExpression
2666 ;
2667
2668 BitAndExpression:
2669 BitNotExpression
2670 | BitAndExpression And4b BitNotExpression
2671 ;
2672
2673 BitNotExpression:
2674 AddExpression
2675 | Not4b AddExpression
2676 ;
2677
2678 AddExpression:
2679 MulExpression
2680 | AddExpression AddOp MulExpression
2681 ;
2682
2683 MulExpression:
2684 UnaryExpression
2685 | MulExpression MultiplyOp UnaryExpression
2686 ;
2687
2688 UnaryExpression:
2689 Primary
2690 | UnaryOp Primary
2691 ;
2692
2693 Primary:
2694 OpCall
2695 | Value
2696 | '(' SingleExpression ')'
2697 ;
2698
2699 optExtendedFieldReference:
2700 /* empty */
2701 | optExtendedFieldReference Dot FieldIdentifier
2702 | optExtendedFieldReference ArrayOrBitRef
2703 ;
2704
2705 FieldIdentifier:
2706 Identifier
2707 | PredefinedType
2708 | Identifier TypeActualParList
2709 ;
2710
2711 OpCall:
2712 ConfigurationOps
2713 | VerdictOps
2714 | TimerOps
2715 | TestcaseInstance
2716 | FunctionInstance
2717 | TemplateOps
2718 | ActivateOp
2719 ;
2720
2721 AddOp:
2722 '+'
2723 | '-'
2724 | StringOp
2725 ;
2726
2727 MultiplyOp:
2728 '*'
2729 | '/'
2730 | Mod
2731 | Rem
2732 ;
2733
2734 UnaryOp:
2735 '+'
2736 | '-'
2737 ;
2738
2739 RelOp:
2740 '<'
2741 | '>'
2742 | GE
2743 | LE
2744 ;
2745
2746 EqualOp:
2747 EQ
2748 | NE
2749 ;
2750
2751 StringOp:
2752 '&'
2753 ;
2754
2755 ShiftOp:
2756 SL
2757 | SR
2758 | RL
2759 | RR
2760 ;
2761
2762 LogStatement:
2763 LogKeyword '(' seqLogItem ')'
2764 ;
2765
2766 seqLogItem:
2767 LogItem
2768 | seqLogItem ',' LogItem
2769 ;
2770
2771 LogItem:
2772 /* FreeText -- covered by the next rule */
2773 TemplateInstance
2774 ;
2775
2776 LoopConstruct:
2777 ForStatement
2778 | WhileStatement
2779 | DoWhileStatement
2780 ;
2781
2782 ForStatement:
2783 ForKeyword '(' Initial SemiColon Final SemiColon Step ')'
2784 StatementBlock
2785 ;
2786
2787 Initial:
2788 VarInstance
2789 | Assignment
2790 ;
2791
2792 Final:
2793 BooleanExpression
2794 ;
2795
2796 Step:
2797 Assignment
2798 ;
2799
2800 WhileStatement:
2801 WhileKeyword '(' BooleanExpression ')'
2802 StatementBlock
2803 ;
2804
2805 DoWhileStatement:
2806 DoKeyword StatementBlock
2807 WhileKeyword '(' BooleanExpression ')'
2808 ;
2809
2810 ConditionalConstruct:
2811 IfKeyword '(' BooleanExpression ')'
2812 StatementBlock
2813 seqElseIfClause optElseClause
2814 ;
2815
2816 seqElseIfClause:
2817 /* empty */
2818 | seqElseIfClause ElseIfClause
2819 ;
2820
2821 ElseIfClause:
2822 ElseKeyword IfKeyword '(' BooleanExpression ')' StatementBlock
2823 ;
2824
2825 optElseClause:
2826 /* empty */
2827 | ElseKeyword StatementBlock
2828 ;
2829
2830 SelectCaseConstruct:
2831 SelectKeyword '(' SingleExpression ')' SelectCaseBody
2832 ;
2833
2834 SelectCaseBody:
2835 '{' seqSelectCase '}'
2836 ;
2837
2838 seqSelectCase:
2839 SelectCase
2840 | seqSelectCase SelectCase
2841 ;
2842
2843 SelectCase:
2844 CaseKeyword '(' seqTemplateInstance ')' StatementBlock
2845 | CaseKeyword ElseKeyword StatementBlock
2846 ;
2847
2848 seqTemplateInstance:
2849 TemplateInstance
2850 | seqTemplateInstance ',' TemplateInstance
2851 ;
2852
2853 /* A.1.6.9 Miscellanous productions */
2854
2855 Dot:
2856 '.'
2857 ;
2858
2859 Dash:
2860 '-'
2861 ;
2862
2863 Minus:
2864 '-'
2865 ;
2866
2867 SemiColon:
2868 ';'
2869 ;
2870
2871 optSemiColon:
2872 /* empty */
2873 | ';'
2874 ;
2875
2876 Colon:
2877 ':'
2878 ;
2879
2880 /* A.1 ASN.1 support */
2881
2882 optDefinitiveIdentifier:
2883 /* empty */
2884 | DefinitiveIdentifier
2885 ;
2886
2887 DefinitiveIdentifier:
2888 Dot ObjectIdentifierKeyword '{' DefinitiveObjIdComponentList '}'
2889 ;
2890
2891 DefinitiveObjIdComponentList:
2892 DefinitiveObjIdComponent
2893 | DefinitiveObjIdComponentList DefinitiveObjIdComponent
2894 ;
2895
2896 DefinitiveObjIdComponent:
2897 NameForm
2898 | DefinitiveNumberForm
2899 | DefinitiveNameAndNumberForm
2900 ;
2901
2902 DefinitiveNumberForm:
2903 Number
2904 ;
2905
2906 DefinitiveNameAndNumberForm:
2907 Identifier '(' DefinitiveNumberForm ')'
2908 ;
2909
2910 ObjectIdentifierValue:
2911 ObjectIdentifierKeyword '{' ObjIdComponentList '}'
2912 ;
2913
2914 ObjIdComponentList:
2915 ObjIdComponent
2916 | ObjIdComponentList ObjIdComponent
2917 ;
2918
2919 ObjIdComponent:
2920 /* NameForm -- covered by NumberForm (as ReferencedValue) */
2921 NumberForm
2922 | NameAndNumberForm
2923 ;
2924
2925 NumberForm:
2926 Number
2927 | ReferencedValue
2928 ;
2929
2930 NameAndNumberForm:
2931 Identifier '(' NumberForm ')'
2932 ;
2933
2934 NameForm:
2935 Identifier
2936 ;
2937
2938 %%
2939
2940 /* Additional C code */
2941
2942 extern int yylineno;
2943 extern char *yytext;
2944 extern FILE *yyin;
2945
2946 extern int dot_flag;
2947
2948 void yyerror(char *s)
2949 {
2950 fprintf(stderr, "line %d: syntax error at or near token '%s': "
2951 "%s\n", yylineno, yytext, s);
2952 }
2953
2954 void parse_input()
2955 {
2956 dot_flag = 0;
2957 if (!yyparse()) fprintf(stderr, "The input was parsed successfully!\n");
2958 else fprintf(stderr, "Parse error!\n");
2959 }
2960
2961 int main(int argc, char *argv[])
2962 {
2963 puts("TTCN-3 parser. Complies with BNF v3.0.0\n"
2964 "Copyright (c) 2000-2015 Ericsson Telecom AB");
2965 if (argc > 1) {
2966 int i;
2967 for (i = 1; i < argc; i++) {
2968 yyin = fopen(argv[i], "r");
2969 if (yyin == NULL) {
2970 fprintf(stderr, "%s: Cannot open file"
2971 " %s for reading: %s\n", argv[0], argv[i],
2972 strerror(errno));
2973 return 1;
2974 }
2975 printf("Parsing file %s ...\n", argv[i]);
2976 parse_input();
2977 fclose(yyin);
2978 }
2979 } else {
2980 puts("Parsing standard input ...");
2981 parse_input();
2982 }
2983 return 0;
2984 }
This page took 0.090232 seconds and 6 git commands to generate.