[4] | 1 | module Identifiers {
|
---|
| 2 | //ALSO not ready for formatting, investigate
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | group module_parameters{
|
---|
| 6 | //module parameters - done
|
---|
| 7 | //TREE => ModuleDef->ModuleParDef->ModulePar->Type
|
---|
| 8 | // ->ModuleParList->Identifier | ConstExpression
|
---|
| 9 | // ->MultitypedModuleParList->ModulePar*
|
---|
| 10 | //
|
---|
| 11 | modulepar u_1 mp_1, mp_2;
|
---|
| 12 | modulepar integer mp_3, mp_4, mp_5 := 1, mp_6;
|
---|
| 13 | modulepar {
|
---|
| 14 | u_1 mp_7 :=1, mp_8;
|
---|
| 15 | integer mp_9;
|
---|
| 16 | }
|
---|
| 17 | modulepar{
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | //=======================================//
|
---|
| 23 |
|
---|
| 24 | group signatures{
|
---|
| 25 | //signature definitions - done
|
---|
| 26 | //TREE => ModuleDef->SignatureDef->Identifier
|
---|
| 27 | signature s_1 ();
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | group templates{
|
---|
| 31 | //template definitions - done ?
|
---|
| 32 | //TREE => ModuleDef->TemplateDef->TemplateRestriction ?
|
---|
| 33 | // ->BaseTemplate->Type | Signature
|
---|
| 34 | // ->Identifier
|
---|
| 35 | template integer pt_1 := 1;
|
---|
| 36 |
|
---|
| 37 | template u_1 ut_1 := {
|
---|
| 38 | field1 := pt_1
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | template u_1 ut_2 modifies ut_1 := {
|
---|
| 42 | field1 :=2
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | template u_1 put_1 (integer p_1) := {
|
---|
| 46 | field1 := p_1
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | template u_1 put_1 (u_1 p_1) := { //repeated identifier
|
---|
| 50 | field1 := p_1
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | template (omit) u_1 oput_1 (u_1 p_1) := {
|
---|
| 54 | field1 := p_1
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | // template (value)
|
---|
| 58 |
|
---|
| 59 | // template (present)
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | group types{
|
---|
| 66 | //type definitions
|
---|
| 67 |
|
---|
| 68 | group structured{
|
---|
| 69 | //structured - done
|
---|
| 70 | //ports - done
|
---|
| 71 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->PortDef->Identifier
|
---|
| 72 | type port p_1 message{
|
---|
| 73 | inout subtype_1
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | //components - done - identical to ports
|
---|
| 77 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->ComponentDef->Identifier
|
---|
| 78 | type component comp_1 {
|
---|
| 79 | var subtype_1 localDef_1;
|
---|
| 80 | //...
|
---|
| 81 | }
|
---|
| 82 | type component comp_2 extends comp_1 {
|
---|
| 83 | var subtype_1 localDef_2;
|
---|
| 84 | //...
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | //enum - done
|
---|
| 88 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->EnumDef->Identifier | address
|
---|
| 89 |
|
---|
| 90 | type enumerated address {A,B};
|
---|
| 91 |
|
---|
| 92 | type enumerated subtype_1 {X, y, Z};
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | //unions - done - similar to sets and records
|
---|
| 96 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->UnionDef->UnionDefBody->Identifier | address
|
---|
| 97 | type union address {subtype_1 field_1}
|
---|
| 98 |
|
---|
| 99 | type union u_1{
|
---|
| 100 | subtype_1 field_1
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | group sets_and_records{
|
---|
| 104 | //records - done
|
---|
| 105 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->RecordDef->StructDefBody->Identifier | address
|
---|
| 106 | type record address {}
|
---|
| 107 |
|
---|
| 108 | type record r_1{
|
---|
| 109 | subtype_1 field_1
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | //sets - done - identical to records
|
---|
| 113 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->SetDef->StructDefBody->Identifier | address
|
---|
| 114 | type set address {}
|
---|
| 115 |
|
---|
| 116 | type set s_1{
|
---|
| 117 | subtype_1 field_1
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | //record of - done
|
---|
| 121 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->RecordOfDef->StringLength ?
|
---|
| 122 | // ->StructOfDefBody->(Type | NestedTypeDef)->Identifier | address
|
---|
| 123 | type record of subtype_1 address (a,b) //=> this should be legit generates errors though
|
---|
| 124 | type record of subtype_1 ro_1
|
---|
| 125 |
|
---|
| 126 | type record length(2) of subtype_1 address (a,b)
|
---|
| 127 | type record length(2..4) of subtype_1 ro_2
|
---|
| 128 |
|
---|
| 129 | //with nested types
|
---|
| 130 | type record of record{subtype_1 field_1} address (a,b)
|
---|
| 131 | type record of record{subtype_1 field_1} ron_1
|
---|
| 132 |
|
---|
| 133 | type record length(2) of record{subtype_1 field_1} address (a,b)
|
---|
| 134 | type record length(2..4) of record{subtype_1 field_1} ro_2
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | //set of - done - identical to record of
|
---|
| 138 | //TREE => ModuleDef->TypeDef->StructuredTypeDef->SetOfDef->StringLength ?
|
---|
| 139 | // ->StructOfDefBody->(Type | NestedTypeDef)->Identifier | address
|
---|
| 140 | type set of subtype_1 address (a,b)
|
---|
| 141 | type set of subtype_1 ro_1
|
---|
| 142 |
|
---|
| 143 | type set length(2) of subtype_1 address (a,b)
|
---|
| 144 | type set length(2..4) of subtype_1 ro_2
|
---|
| 145 |
|
---|
| 146 | //with nested types
|
---|
| 147 | type set of set{subtype_1 field_1} address (a,b)
|
---|
| 148 | type set of record{subtype_1 field_1} ron_1
|
---|
| 149 |
|
---|
| 150 | type set length(2) of record{subtype_1 field_1} address (a,b)
|
---|
| 151 | type set length(2..4) of set{subtype_1 field_1} ro_2
|
---|
| 152 |
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 | group subtyped{
|
---|
| 156 | //subtyped - done
|
---|
| 157 | //TREE => ModuleDef->TypeDef->SubTypeDef->Type
|
---|
| 158 | // ->Identifier | address
|
---|
| 159 |
|
---|
| 160 | type integer subtype_a;
|
---|
| 161 |
|
---|
| 162 | type subtype_a subtype_b;
|
---|
| 163 |
|
---|
| 164 | type integer subtype_1 (1..10);
|
---|
| 165 |
|
---|
| 166 | type subtype_1 subtype_2 (4..8);
|
---|
| 167 |
|
---|
| 168 | type integer address (A .. D);
|
---|
| 169 |
|
---|
| 170 | type subtype_1 address (X, y, Z);
|
---|
| 171 |
|
---|
| 172 | type integer subtype_3[3] (1..10);
|
---|
| 173 |
|
---|
| 174 | type subtype_1 subtype_4[4] (4..8);
|
---|
| 175 |
|
---|
| 176 | type integer address[2] (A .. D);
|
---|
| 177 |
|
---|
| 178 | type subtype_1 address[2] (X, y, Z);
|
---|
| 179 |
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | group constants{
|
---|
| 184 | //constant definitions - done
|
---|
| 185 | //TREE => ModuleDefinition->ConstDef->Type
|
---|
| 186 | // ->SingleConstDef->Identifier
|
---|
| 187 | const subtype_1 c_1 := x;
|
---|
| 188 | const subtype_2 c_2 := y,c_3 := z;
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | group functions{
|
---|
| 192 | //function definitions - done
|
---|
| 193 | //TREE => ModuleDefinition->FunctionDef->Identifier
|
---|
| 194 |
|
---|
| 195 | function f_1 () runs on comp_1 {
|
---|
| 196 | var subtype_1 localDef_1;
|
---|
| 197 | //...
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | function f_2 (subtype_1 fp_1, subtype_2 fp_2) runs on comp_1 {
|
---|
| 201 | var subtype_1 localDef_1;
|
---|
| 202 | //...
|
---|
| 203 | }
|
---|
| 204 | }
|
---|
| 205 |
|
---|
| 206 | group testcases{
|
---|
| 207 | //testcase definitions - done
|
---|
| 208 | //TREE => ModuleDefinition->TestcaseDef->Identifier
|
---|
| 209 |
|
---|
| 210 | testcase tc_1 () runs on comp_1 system sys_1 {
|
---|
| 211 | var subtype_1 localDef_1;
|
---|
| 212 | //...
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | testcase tc_2 (subtype_1 fp_1, subtype_2 fp_2) runs on comp_1 system sys_1 {
|
---|
| 216 | var subtype_1 localDef_1;
|
---|
| 217 | //...
|
---|
| 218 | }
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | group altsteps{
|
---|
| 222 | //altstep definitions - done
|
---|
| 223 | //TREE => ModuleDefinition->AltstepDef->Identifier
|
---|
| 224 |
|
---|
| 225 | altstep as_1 () runs on comp_1{
|
---|
| 226 | var subtype_1 localDef_1;
|
---|
| 227 | //...
|
---|
| 228 | }
|
---|
| 229 |
|
---|
| 230 | altstep as_2 (type_1 fp_1, type_2 fp_2) runs on comp_1{
|
---|
| 231 | var subtype_1 localDef_1;
|
---|
| 232 | //...
|
---|
| 233 | }
|
---|
| 234 | }
|
---|
| 235 |
|
---|
| 236 | //=======================================//
|
---|
| 237 |
|
---|
| 238 | //group definitions - done
|
---|
| 239 | ////TREE => ModuleDefinition->GroupDef->Identifier
|
---|
| 240 | group g_1 {
|
---|
| 241 | group g_2{
|
---|
| 242 |
|
---|
| 243 | }
|
---|
| 244 | }
|
---|
| 245 |
|
---|
| 246 | //=======================================//
|
---|
| 247 |
|
---|
| 248 | group externals{
|
---|
| 249 | //external constant definitions - done
|
---|
| 250 | //TREE => ModuleDefinition->ExtConstDef->Type
|
---|
| 251 | // ->Identifier+
|
---|
| 252 | external const subtype_1 cx_1;
|
---|
| 253 | external const type_2 cx_2, cx_3;
|
---|
| 254 |
|
---|
| 255 | //external function definitions - done
|
---|
| 256 | //TREE => ModuleDefinition->ExtFunctionDef->Identifier
|
---|
| 257 | external function fx_1 ();
|
---|
| 258 | external function fx_2 (type_1 fp_1, type_2 fp_2) return type_3;
|
---|
| 259 | }
|
---|
| 260 | } |
---|