た場合の表記だけを示してある.
これらの予約語は,クラス名,イベント名,フィールド名,オペレーション名,遷移規 則名,属性名などに使用できない.
A.2
特殊記号
表A.2に特殊記号を列挙し,呼称と使途を示す.
記号 呼称 使途
-- doubledash コメントのはじまり.
; semicolon 宣言の区切り,ブロックの区切りなど.
, comma 引数の区切り,宣言の中の実体の並びの区切
りなど.
: colon 宣言中の型指定のはじまり.
. dot イベントの参照でのフィールド指定の区切り,
イベントのオペレーション呼出しの区切り.
= /= Equal,not-equal signs 等しい,等しくない.
( ) Parentheses 部分式のグループ化,実引数,仮引数の括り.
{ } Braces 内部オブジェクトのグループ化.
:= Receives 代入記号.
' single quote 文字定数の括り.
" double quote 文字列定数の括り.
+ - Signs 整数,実数の符号.
表 A.2: 特殊記号一覧表
順位 記号
9 .
8 not unary + unary
-7 ^(power)
6 * /
5 binary + binary
-4 = /=(notequal) < > <= >=
3 and and then
2 or or else xor
1 ;
表A.3: 演算子とその優先順位の一覧表
A.4
構文規則
本節ではObCLの構文規則を示す.
ここでの構文規則の表記法は,次のようなものとする.
非終端記号は大文字で始まる.
+や0 のような終端記号は二重引用符で囲む.
class のような肉太書体で書いた終端記号はそのままとなる.
垂直線 jは選択を表す.
丸カッコ( と) はグループ化に用いる.
(111)? はオプショナルな(0回か1回の)構造を表す.
(111)3は0 回以上の繰り返しを表す.
(111)+ は1 回以上の繰り返しを表す.
Program ::= ( (Indexing )?
(Class declaration
j Field declaration
j Event class declaration )
)3EOF
A.4.2 Indexing
Indexing ::= indexing( Index list )?
Index list ::= Index clause ( ";"Index clause)3
Index clause ::= Index (Index term( "," Index term )3 )?
Index ::= Identire ":"
Index term ::= Identirej Manifest constant
A.4.3 Class declaration
Class declaration ::= Class header ( Parent )? (Features )? end
A.4.4 Class header
Class header ::= class Class name
A.4.5 Class name
Class name ::= Identire
A.4.6 Class Inheritnce
Features ::= ( Fields ref )?
(Attributes)?
(States )?
(Inners )?
(Creations )?
(Operations )?
Transitions
A.4.8 Fields ref
Fields ref ::= eld ( Field ref list )?
Field ref list ::= Field name ("," Field name )3
Field name ::= Identire
A.4.9 Attributes
Attributes ::= attribute (Attribute list)?
Attributelist ::= Attributename ( ","Attribute name )3
Attribute name ::= Identire
A.4.10 States
States ::= state( State list )?
State list ::= State name ( ","State name)3
State name ::= Identire
Inners ::= inner ( Inner list )?
Inner list ::= ( Inner declaration group list )+
Inner declaration group list ::= Inner declaration group
(";" Inner declaration group )3
Inner declaration group ::= Identire ("," Identire )3 ":"
(Class name
j"{" Inner declaration group list "}")
A.4.12 Class mark
Class mark ::= ":" Class name
A.4.13 Creations
Creations ::= creation ( Creation operation name list)?
Creation op eration name list ::= Operation name ( ","Operation name )3
A.4.14 Operations
Operations ::= operation ( Operation declaration list)?
Operation declaration list ::= Operation declaration
( ( ";")? Operation declaration )3
A.4.15 Operation declaration
Operation declaration ::= Operation name (Operation argument list)?
(Type mark )? Operation value mark
Op eration value mark ::= is( Manifest constant jRoutine )
Operation name ::= Identire
A.4.18 Entity declaration list
Entity declaration list ::= Identire( ","Identire)3
A.4.19 Type mark
Typ e mark ::= Class mark
A.4.20 Routine
Routine ::= ( Local declarations)? Routine bodyend
Local declarations ::= local ( Entity declaration list )?
A.4.21 Routine body
Routine b ody ::= do ( Compound )?
A.4.22 Compound
Compound ::= Instruction ( ";"Instruction )3
Instruction ::= Assignment j Conditionalj Loop jCall
A.4.23 Boolean expression
Boolean expression ::= Expression
A.4.24 Assignment
Assignment ::= Writable":=" Expression
Call ::= ( Parenthesised qualier )? Call chain
Parenthesised qualier ::= Parenthesised "."
Call chain ::= Unquantied call ( "." Unquantied call )3
A.4.26 Unquantied call
Unquantied call ::= Operation name (Actuals )?
A.4.27 Actuals
Actuals ::= "("Actual list ")"
Actual list ::= Actual ( ","Actual )3
Actual ::= Expression
A.4.28 Expression
Expression ::= ( UnaryExpression
j Parenthesised
j Call
j Local
j Constant)
(Expression d)?
Expression d ::= ( Comparisonj Binary )Expression ( Expression d )?
A.4.29 Parenthesised
Parenthesised ::= "(" Expression")"
Comparison ::= "=" j"/="
Binary ::= "+"j "-" j "*"j "/"
j "<"j "<=" j ">" j ">="
j "^"
j and ( then )? j or (else )? j xor
A.4.32 Conditional
Conditional ::= ifThen part list ( Elsepart )? end
Then part list ::= Then part ( elsifThen part )3
Then part ::= Boolean expression then Compound
A.4.33 Else part
Elsepart ::= else Comp ound
A.4.34 Loop
Lo op ::= Loop initial Loop body end
Loop initial ::= from Compound
Lo op bo dy ::= Exit clause loop Compound
Exit clause ::= until Bo olean expression
A.4.35 Constant
Constant ::= Manifest constant
Constant attribute ::= Identire
A.4.36 Manifest constant
Manifest constant ::= Bo olean constant
j Manifest string
j Integer constant
j Character constant
Boolean constant ::= true j false
Sign ::= "+" j"-"
A.4.38 Manifest string
Manifest string ::= String literal
A.4.39 Integer constant
Integer constant ::= ( Sign)? Integer
A.4.40 Integer
Integer ::= Plain integer jDelimited integer
A.4.41 Character constant
Character constant ::= Character literal
A.4.42 Writable
Writable ::= Identire j result
A.4.43 Local
Local ::= Identirej result
A.4.44 Transitions
Transitions ::= transition (Transition declaration list)?
Transition declaration ::= Transition name Transition value mark
Transition name ::= Identire
Transition value mark ::= is Tratisition routine
A.4.46 Transition routine
Tratisition routine ::= Source clause
(Transition routine bo dy )?
Destination clause end
A.4.47 Source clause
Source clause ::= source( init j State name ) (Source b ody )?
A.4.48 Source body
Source b ody ::= input Event list( when Bo olean expression)?
A.4.49 Transition routine body
Transition routine b ody ::= ( Local declarations)? Routine body
A.4.50 Destination body
Destination clause ::= destinationState name( output Event list )?
A.4.51 Event list
Event list ::= Qualied event name
("," Qualied event name)3
Qualied event name ::= Field name "."Event name
Event name ::= Identire
Event class declaration ::= Event class header
(Eventclass parent)?
(Attributes)?
(Operations )?
end
Event class header ::= event Event class name
Event class name ::= Identire
A.4.53 Event Inheritnce
Event class parent ::= inherit Event class name
A.4.54 Field declaration
Field declaration ::= Field header
(Included events)?
end
Field header ::= eld Field name
Included events ::= event (Eventdeclaration list )?
Event declaration list ::= Event declaration group
(( ";" )? Event declaration group )3
A.4.55 Event declaration group
Event declaration group ::= Event name
("," Event name )3 Event mark
Event mark ::= ":" Eventclass name