No Magic, Inc.
Copyright © 2010 No Magic, Inc.
ad/2010-08-01 1
1
Concrete Syntax for a UML Action Language 1
Action Language for Foundational UML (Alf)
Second Revised Submission 1
23 August 2010 1
Submitted by 1
Model Driven Solutions 1
Mentor Graphics Corporation 1
International Business Machines 1
88solutions Corporation 1
No Magic, Inc. 1
Visumpoint 1
Supported by 1
Ericsson 1
CEA 1
Lockheed Martin 1
Thales 1
Contents i
INTRODUCTION 1
INTRODUCTION 1
0 Introduction 1
0.1 Contacts 1
0.2 Proof of Concept 1
0.3 Resolution of RFP Requirements 1
0.3.1 Mandatory Requirements 1
0.3.2 Optional Requirements 3
0.4 Issues To Be Discussed 3
1 Scope 9
2 Conformance 10
2.1 Syntactic Conformance 10
2.2 Semantic Conformance 10
2.3 Additional Conformance Points 11
3 Normative References 12
4 Terms and Definitions 13
5 Symbols 14
6 Overview 15
6.1 Integration with UML Models 15
6.2 Templates 16
6.3 Lexical Structure 18
6.4 Concrete Syntax 19
6.5 Abstract Syntax 21
6.6 Mapping to Foundational UML 22
6.7 Organization of the Specification 23
PART I - LANGUAGE DESCRIPTION 25
PART I - LANGUAGE DESCRIPTION 25
7 Lexical Structure 25
7.1 Line Terminators 25
7.2 Input Elements and Tokens 25
7.3 White Space 26
7.4 Comments 26
7.4.1 Lexical Comments 27
7.4.2 Documentation Comments 27
7.5 Names 28
7.6 Reserved Words 30
7.7 Primitive Literals 30
7.7.1 Boolean Literals 30
7.7.2 Natural Literals 31
7.7.3 Unbounded Value Literals 32
7.7.4 String Literals 33
7.8 Punctuation 33
7.9 Operators 33
8 Expressions 34
8.1 Overview 34
8.2 Qualified Names 36
8.3 Primary Expressions 42
8.3.1 Overview 42
8.3.2 Literal Expressions 43
8.3.3 Name Expressions 44
8.3.4 this Expressions 46
8.3.5 Parenthesized Expressions 47
8.3.6 Property Access Expressions 47
8.3.7 Invocation Expressions 50
8.3.8 Tuples 51
8.3.9 Behavior Invocation Expressions 54
8.3.10 Feature Invocation Expressions 57
8.3.11 Super Invocation Expressions 60
8.3.12 Instance Creation Expressions 62
8.3.13 Link Operation Expressions 65
8.3.14 Class Extent Expressions 68
8.3.15 Sequence Construction Expressions 69
8.3.16 Sequence Access Expressions 72
8.3.17 Sequence Operation Expressions 73
8.3.18 Sequence Reduction Expressions 76
8.3.19 Sequence Expansion Expressions 78
8.3.20 select and reject Expressions 81
8.3.21 collect and iterate Expressions 82
8.3.22 forAll, exists and one Expressions 83
8.3.23 isUnique Expression 84
8.4 Increment and Decrement Expressions 85
8.5 Unary Expressions 86
8.5.1 Overview 86
8.5.2 Boolean Unary Expressions 87
8.5.3 BitString Unary Expressions 88
8.5.4 Numeric Unary Expressions 89
8.5.5 Cast Expressions 90
8.5.6 Isolation Expressions 91
8.6 Binary Expressions 92
8.6.1 Overview 92
8.6.2 Arithmetic Expressions 93
8.6.3 Shift Expressions 94
8.6.4 Relational Expressions 96
8.6.5 Classification Expressions 97
8.6.6 Equality Expressions 99
8.6.7 Logical Expressions 100
8.6.8 Conditional Logical Expressions 102
8.7 Conditional-Test Expressions 103
8.8 Assignment Expressions 105
9 Statements 110
9.1 Overview 110
9.2 Annotated Statements 113
9.3 In-line Statements 116
9.4 Block Statements 117
9.5 Empty Statements 120
9.6 Local Name Declaration Statements 121
9.7 Expression Statements 124
9.8 if Statements 125
9.9 switch Statements 128
9.10 while Statements 130
9.11 do Statements 132
9.12 for Statements 133
9.13 break Statements 137
9.14 return Statements 138
9.15 accept Statements 139
9.16 classify Statements 142
10 Units 144
10.1 Overview 144
10.2 Namespaces 151
10.3 Packages 153
10.4 Classifiers 155
10.4.1 Overview 155
10.4.2 Classes 158
10.4.3 Active Classes 162
10.4.4 Data Types 165
10.4.5 Associations 167
10.4.6 Enumerations 168
10.4.7 Signals 170
10.4.8 Activities 171
10.5 Features 175
10.5.1 Overview 175
10.5.2 Properties 176
10.5.3 Operations 179
10.5.3.1 Constructors 183
10.5.3.2 Destructors 186
10.5.4 Receptions 188
11 Standard Model Library 191
11.1 ActionLanguage Profile 191
11.2 Primitive Types 192
11.2.1 Natural Type 192
11.2.2 Bit String Type 193
11.3 Primitive Behaviors 193
11.3.1 Boolean Functions 194
11.3.2 Integer Functions 195
11.3.3 String Functions 196
11.3.4 UnlimitedNatural Functions 196
11.3.5 Bit String Functions 197
11.3.6 Sequence Functions 200
11.4 Basic Input and Output 205
11.5 Collection Functions 205
11.6 Collection Classes 208
11.6.1 Bag 211
11.6.2 Collection 211
11.6.3 Deque 214
11.6.4 Entry 216
11.6.5 List 216
11.6.6 Map 219
11.6.7 OrderedSet 222
11.6.8 Queue 226
11.6.9 Set 229
PART II - ABSTRACT SYNTAX 230
PART II - ABSTRACT SYNTAX 230
12 Common Abstract Syntax 230
12.1 Overview 230
12.2 Class Descriptions 232
12.2.1 AssignedSource 232
12.2.2 DocumentedElement 233
12.2.3 ElementReference 233
12.2.4 ExternalElementReference 234
12.2.5 InternalElementReference 234
12.2.6 SyntaxElement 234
13 Expressions Abstract Syntax 236
13.1 Overview 236
13.2 Class Descriptions 243
13.2.1 ArithmeticExpression 243
13.2.2 AssignmentExpression 244
13.2.3 BehaviorInvocationExpression 247
13.2.4 BinaryExpression 248
13.2.5 BitStringUnaryExpression 249
13.2.6 BooleanLiteralExpression 250
13.2.7 BooleanUnaryExpression 251
13.2.8 CastExpression 251
13.2.9 ClassExtentExpression 252
13.2.10 ClassificationExpression 253
13.2.11 CollectOrIterateExpression 254
13.2.12 ConditionalLogicalExpression 255
13.2.13 ConditionalTestExpression 256
13.2.14 EqualityExpression 257
13.2.15 Expression 258
13.2.16 ExtentOrExpression 259
13.2.17 FeatureInvocationExpression 259
13.2.18 FeatureLeftHandSide 260
13.2.19 FeatureReference 261
13.2.20 ForAllOrExistsOrOneExpression 262
13.2.21 IncrementOrDecrementExpression 262
13.2.22 InstanceCreationExpression 264
13.2.23 InvocationExpression 265
13.2.24 IsolationExpression 268
13.2.25 IsUniqueExpression 268
13.2.26 LeftHandSide 269
13.2.27 LinkOperationExpression 270
13.2.28 LiteralExpression 271
13.2.29 LogicalExpression 271
13.2.30 NameBinding 273
13.2.31 NamedExpression 273
13.2.32 NamedTemplateBinding 274
13.2.33 NamedTuple 274
13.2.34 NameExpression 275
13.2.35 NameLeftHandSide 276
13.2.36 NaturalLiteralExpression 277
13.2.37 NumericUnaryExpression 278
13.2.38 OutputNamedExpression 278
13.2.39 PositionalTemplateBinding 279
13.2.40 PositionalTuple 280
13.2.41 PropertyAccessExpression 280
13.2.42 QualifiedName 281
13.2.43 RelationalExpression 283
13.2.44 SelectOrRejectExpression 284
13.2.45 SequenceAccessExpression 285
13.2.46 SequenceConstructionExpression 286
13.2.47 SequenceElements 287
13.2.48 SequenceExpansionExpression 287
13.2.49 SequenceExpressionList 289
13.2.50 SequenceOperationExpression 289
13.2.51 SequenceRange 291
13.2.52 SequenceReductionExpression 291
13.2.53 ShiftExpression 293
13.2.54 StringLiteralExpression 293
13.2.55 SuperInvocationExpression 294
13.2.56 TemplateBinding 295
13.2.57 TemplateParameterSubstitution 295
13.2.58 ThisExpression 296
13.2.59 Tuple 296
13.2.60 UnaryExpression 298
13.2.61 UnboundedLiteralExpression 298
14 Statements Abstract Syntax 300
14.1 Overview 300
14.2 Class Descriptions 304
14.2.1 AcceptBlock 304
14.2.2 AcceptStatement 305
14.2.3 Annotation 306
14.2.4 Block 307
14.2.5 BlockStatement 308
14.2.6 BreakStatement 309
14.2.7 ClassifyStatement 309
14.2.8 ConcurrentClauses 311
14.2.9 DoStatement 311
14.2.10 EmptyStatement 312
14.2.11 ExpressionStatement 313
14.2.12 ForStatement 313
14.2.13 IfStatement 315
14.2.14 InLineStatement 316
14.2.15 LocalNameDeclarationStatement 317
14.2.16 LoopVariableDefinition 318
14.2.17 NonFinalClause 320
14.2.18 QualifiedNameList 321
14.2.19 ReturnStatement 321
14.2.20 Statement 322
14.2.21 SwitchClause 323
14.2.22 SwitchStatement 324
14.2.23 WhileStatement 326
15 Units Abstract Syntax 327
15.1 Overview 327
15.2 Class Descriptions 329
15.2.1 ActiveClassDefinition 329
15.2.2 ActivityDefinition 330
15.2.3 AssociationDefinition 331
15.2.4 ClassDefinition 331
15.2.5 ClassifierDefinition 332
15.2.6 ClassifierTemplateParameter 333
15.2.7 DataTypeDefinition 334
15.2.8 ElementImportReference 334
15.2.9 EnumerationDefinition 335
15.2.10 EnumerationLiteralName 336
15.2.11 FormalParameter 336
15.2.12 ImportedMember 337
15.2.13 ImportReference 337
15.2.14 Member 338
15.2.15 NamespaceDefinition 340
15.2.16 OperationDefinition 341
15.2.17 PackageDefinition 343
15.2.18 PackageImportReference 344
15.2.19 PropertyDefinition 344
15.2.20 ReceptionDefinition 345
15.2.21 SignalDefinition 346
15.2.22 SignalReceptionDefinition 347
15.2.23 StereotypeAnnotation 347
15.2.24 TaggedValue 349
15.2.25 TaggedValueList 349
15.2.26 TypedElementDefinition 350
15.2.27 UnitDefinition 351
PART III - MAPPING TO FOUNDATIONAL UML 353
PART III - MAPPING TO FOUNDATIONAL UML 353
16 Common Mapping 353
16.1 Syntax Elements 353
16.2 Documented Elements 353
16.3 Element References 353
16.4 Assigned Sources 354
17 Expressions Mapping 355
17.1 General 355
17.2 Qualified Names 355
17.3 Literal Expressions 355
17.4 Name Expressions 355
17.5 this Expressions 356
17.6 Property Access Expressions 356
17.7 Invocation Expressions 356
17.8 Tuples 357
17.9 Behavior Invocation Expressions 357
17.10 Feature Invocation Expressions 358
17.11 Super Invocation Expressions 359
17.12 Instance Creation Expressions 359
17.13 Link Operation Expressions 360
17.14 Class Extent Expressions 361
17.15 Sequence Construction Expression 361
17.16 Sequence Access Expressions 362
17.17 Sequence Operation Expressions 362
17.18 Sequence Reduction Expression 362
17.19 Sequence Expansion Expressions 362
17.20 Increment and Decrement Expressions 364
17.21 Unary Expressions 364
17.22 Binary Expression 365
17.23 Conditional-Test Expressions 367
17.24 Assignment Expressions 368
18 Statements Mapping 371
18.1 General 371
18.2 In-Line Statements 371
18.3 Block Statements 371
18.4 Empty Statements 372
18.5 Local Name Definition Statements 372
18.6 Expression Statements 372
18.7 if Statements 372
18.8 switch Statements 373
18.9 while Statements 373
18.10 do Statements 374
18.11 for Statements 375
18.12 break Statements 376
18.13 return Statements 376
18.14 accept Statements 376
18.15 classify Statements 377
19 Units Mapping 378
19.1 General 378
19.2 Namespace Definitions 378
19.3 Package Definitions 378
19.4 Classifier Definitions 379
19.5 Class Definitions 379
19.6 Active Class Definitions 380
19.7 Data Type Definitions 380
19.8 Association Definitions 380
19.9 Enumeration Definitions 381
19.10 Signal (and Signal Reception) Definitions 381
19.11 Activity Definitions 381
19.12 Typed Element Definitions 382
19.13 Formal Parameters 382
19.14 Property Definitions 382
19.15 Operation Definitions 383
19.16 Reception Definitions 383
PART IV - ANNEXES 384
PART IV - ANNEXES 384
Annex A Semantic Integration with State Machines and Composite Structure
(informative) 384
A.1 State Machines 384
A.2 Composite Structure 388
Annex B Extended Examples
(informative) 392
B.1 Quicksort Activity 392
B.1.1 Quicksort Functional Implementation 392
B.1.2 Quicksort “In Place” Implementation 395
B.2 Online Bookstore 396
B.2.1 Graphical Model for Ordering 396
B.2.2 Alf Representation of Entry Behaviors 399
B.2.3 Alf Representation of the Ordering Model 403
B.2.4 Class Order 405
B.3 Property Management Service 408
B.3.1 The Property Management Model 408
B.3.2 Message Model 411
B.3.3 Service Model 413
B.3.4 Property Management Service Methods 415
B.4 Alf Standard Library Collection Classes Implementation 423
B.4.1 CollectionClasses::Impl 423
B.4.2 CollectionClasses::Impl::CollectionImpl 424
B.4.3 CollectionClasses::Impl::OrderedCollectionImpl 426
B.4.4 CollectionClasses::Impl::Set 427
B.4.5 CollectionClasses::Impl::OrderedSet 428
B.4.6 CollectionClasses::Impl::Bag 429
B.4.7 CollectionClasses::Impl::List 430
B.4.8 CollectionClasses::Impl::Queue 430
B.4.9 CollectionClasses::Impl::Deque 431
B.4.10 CollectionClasses::Impl::Map 432
Annex C Consolidated LL Grammar
(informative) 435
C.1 Lexical Analyzer 435
C.2 Parser 439