Grammar reference

## Contents

- Your rights

- Introduction

- Component model

- Component description file

  - Preprocessing

  - Elements of a description file

  - Data type and constant definitions

  - Module declaration

  - Component declaration

  - Interface declaration

  - IDS declaration

  - Port declaration

  - Task declaration

  - Service declaration

  - Codel declaration

  - Identifiers and reserved keywords

  - Pragmas

  - Grammar reference

- GenoM IDL mappings

- Running GenoM

- Tutorials

- Templates

## Grammar reference

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