5.18 Grammar reference
(1) specification ::= { statement }
(2) statement ::= component
| interface
| idl-statement
(3) idl-statements ::= { idl-statement } idl-statement
(4) idl-statement ::= module
| const-dcl
| type-dcl
(5) component ::= "component" component-name component-body ";"
(6) component-name ::= identifier
(7) component-body ::= [ "{" exports "}" ]
(8) exports ::= { export }
(9) export ::= idl-statement
| property
| ids
| task
| port
| attribute
| service
(10) component-property ::= ( "doc" string-literals | "version"
string-literals | "lang" string-literals |
"email" string-literals | "requires"
string-list | "codels-require" string-list
| "clock-rate" const-expr time-unit |
"provides" interface-list | "uses"
interface-list ) ";"
(11) throw-property ::= "throws" throw-list ";"
(12) throw-list ::= { named-type "," } named-type
(13) interface ::= "interface" interface-scope component-body ";"
(14) interface-scope ::= identifier
(15) interface-name ::= identifier
(16) interface-property ::= "extends" interface-list ";"
(17) interface-list ::= { interface-name "," } interface-name
(18) ids ::= ids-name "{" member-list "}" ";"
(19) ids-name ::= "ids"
(20) task ::= "task" identifier opt-properties ";"
(21) task-property ::= ( "period" const-expr time-unit | "delay"
const-expr time-unit | "priority"
positive-int-const | "scheduling" "real-time" |
"stack" positive-int-const size-unit ) ";"
(22) port ::= "port" opt-multiple port-dir type-spec
identifier ";"
(23) port-dir ::= "in"
| "out"
(24) opt-multiple ::= [ "multiple" ]
(25) attribute ::= "attribute" identifier "(" attribute-parameters
")" opt-properties ";"
(26) service ::= service-kind identifier "(" service-parameters
")" opt-properties ";"
(27) service-kind ::= "function"
| "activity"
(28) service-property ::= ( "task" identifier | "interrupts"
identifier-list | "before" identifier-list |
"after" identifier-list | "validate" codel |
"local" local-variables ) ";"
(29) attribute-parameters ::= [ { attribute-parameter "," }
attribute-parameter ]
(30) attribute-parameter ::= parameter-dir parameter-variable
opt-initializer
(31) service-parameters ::= [ { service-parameter "," } service-parameter ]
(32) service-parameter ::= parameter-dir type-spec declarator
opt-initializer
(33) local-variables ::= ( type-spec | local-variables "," ) declarator
(34) codel ::= identifier "(" codel-parameters ")"
(35) fsm-codel ::= "<" event-list ">" identifier "("
codel-parameters ")" "yields" event-list
(36) opt-async ::= [ "async" ]
(37) event-list ::= { scoped-name "," } scoped-name
(38) codel-parameters ::= [ { codel-parameter "," } codel-parameter ]
(39) codel-parameter ::= opt-parameter-src parameter-dir (
parameter-variable
| parameter-variable "::" identifier | "::"
identifier )
(40) codel-property ::= opt-async "codel" ( codel ";" | fsm-codel ";" )
(41) opt-parameter-src ::= [ "ids" | "local" | "port" | "remote" ]
(42) parameter-dir ::= "in"
| "out"
| "inout"
(43) parameter-variable ::= identifier
| parameter-variable "." identifier
| parameter-variable "[" positive-int-const "]"
(44) opt-initializer ::= [ "=" initializer ]
(45) initializers ::= [ { initializer "," } initializer ]
(46) initializer ::= initializer-value
| ":" string-literals
| initializer-value ":" string-literals
(47) initializer-value ::= const-expr
| "{" initializers "}"
| "[" positive-int-const "]" "=" const-expr
| "[" positive-int-const "]" "=" "{" initializers
"}"
| "[" positive-int-const "]" "="
| "." identifier "=" const-expr
| "." identifier "=" "{" initializers "}"
| "." identifier "="
(48) module ::= "module" module-name "{" module-body "}" ";"
(49) module-name ::= identifier
(50) module-body ::= [ idl-statements ]
(51) scope-push-struct ::= identifier
(52) scope-push-union ::= identifier
(53) exception-name ::= identifier
(54) scoped-name ::= [ [ scoped-name ] "::" ] identifier
(55) const-dcl ::= "const" const-type identifier "=" const-expr
";"
(56) const-type ::= integer-type
| char-type
| boolean-type
| floating-pt-type
| octet-type
| string-type
| named-type
(57) type-dcl ::= constructed-type ";"
| "typedef" alias-list ";"
| "native" identifier ";"
| EXCEPTION exception-list ";"
| forward-dcl
(58) constructed-type ::= struct-type
| union-type
| enum-type
(59) alias-list ::= ( type-spec | alias-list "," ) declarator
(60) struct-type ::= "struct" scope-push-struct "{" member-list "}"
(61) union-type ::= "union" scope-push-union "switch" "("
switch-type-spec ")" "{" switch-body "}"
(62) exception-list ::= { exception-dcl "," } exception-dcl
(63) exception-dcl ::= exception-name opt-member-list
(64) enum-type ::= "enum" identifier "{" enumerator-list "}"
(65) forward-dcl ::= ( "struct" | "union" ) identifier ";"
(66) declarator ::= simple-declarator
| array-declarator
(67) simple-declarator ::= identifier
(68) array-declarator ::= ( simple-declarator | array-declarator )
fixed-array-size
(69) fixed-array-size ::= "[" positive-int-const "]"
(70) type-spec ::= simple-type-spec
| constructed-type-spec
(71) simple-type-spec ::= base-type-spec
| template-type-spec
| named-type
(72) constructed-type-spec ::= constructed-type
(73) named-type ::= scoped-name
(74) base-type-spec ::= boolean-type
| integer-type
| floating-pt-type
| char-type
| octet-type
| any-type
(75) template-type-spec ::= sequence-type
| string-type
| fixed-type
(76) integer-type ::= signed-int
| unsigned-int
(77) floating-pt-type ::= float-type
| double-type
(78) signed-int ::= signed-longlong-int
| signed-long-int
| signed-short-int
(79) unsigned-int ::= unsigned-longlong-int
| unsigned-long-int
| unsigned-short-int
(80) unsigned-short-int ::= "unsigned" "short"
(81) unsigned-long-int ::= "unsigned" "long"
(82) unsigned-longlong-int ::= "unsigned" "long" "long"
(83) signed-short-int ::= "short"
(84) signed-long-int ::= "long"
(85) signed-longlong-int ::= "long" "long"
(86) float-type ::= "float"
(87) double-type ::= "double"
(88) char-type ::= "char"
(89) boolean-type ::= "boolean"
(90) octet-type ::= "octet"
(91) any-type ::= "any"
(92) string-type ::= "string" [ "<" positive-int-const ">" ]
(93) sequence-type ::= "sequence" "<" simple-type-spec ( ","
positive-int-const ">" | ">" )
(94) fixed-type ::= "fixed" [ "<" positive-int-const ","
positive-int-const ">" ]
(95) switch-type-spec ::= integer-type
| char-type
| boolean-type
| enum-type
| named-type
(96) switch-body ::= { case } case
(97) opt-member-list ::= [ "{" ( "}" | member-list "}" ) ]
(98) member-list ::= { member ";" } member ";"
(99) member ::= ( type-spec | member "," ) declarator
(100) case ::= case-label-list type-spec declarator ";"
(101) case-label-list ::= { case-label } case-label
(102) case-label ::= ( "case" const-expr | "default" ) ":"
(103) enumerator-list ::= { enumerator "," } enumerator
(104) enumerator ::= identifier
(105) identifier ::= "[A-Za-z-][A-Za-z0-9-]*"
| "s"
| "ms"
| "us"
| "k"
| "m"
| "real-time"
| "interface"
| "component"
| "ids"
| "attribute"
| "function"
| "activity"
| "version"
| "lang"
| "email"
| "requires"
| "codels-require"
| "clock-rate"
| "task"
| "task"
| "period"
| "delay"
| "priority"
| "scheduling"
| "stack"
| "codel"
| "validate"
| "yields"
| "throws"
| "doc"
| "interrupts"
| "before"
| "after"
| "handle"
| "port"
| "in"
| "out"
| "inout"
| "local"
| "async"
| "remote"
| "extends"
| "provides"
| "uses"
| "multiple"
| "native"
| EXCEPTION
(106) identifier-list ::= { identifier "," } identifier
(107) const-expr ::= or-expr
(108) positive-int-const ::= const-expr
(109) or-expr ::= { xor-expr "|" } xor-expr
(110) xor-expr ::= { and-expr "^" } and-expr
(111) and-expr ::= { shift-expr "&" } shift-expr
(112) shift-expr ::= { add-expr ( ">>" | "<<" ) } add-expr
(113) add-expr ::= { mult-expr ( "+" | "-" ) } mult-expr
(114) mult-expr ::= { unary-expr ( "*" | "/" | "%" ) } unary-expr
(115) unary-expr ::= [ "-" | "+" | "~" ] primary-expr
(116) primary-expr ::= literal
| "(" const-expr ")"
| named-type
(117) literal ::= "TRUE"
| "FALSE"
| integer-literal
| "<float-literal>"
| "<fixed-literal>"
| "<char-literal>"
| string-literals
(118) string-literals ::= { string-literal } string-literal
(119) string-list ::= { string-literals "," } string-literals
(120) time-unit ::= [ "s" | "ms" | "us" ]
(121) size-unit ::= [ "k" | "m" ]
(122) opt-properties ::= [ "{" properties "}" ]
(123) properties ::= { property }
(124) property ::= component-property
| interface-property
| task-property
| service-property
| codel-property
| throw-property