10.4. Massiv IDL Grammar

The description of the Massiv IDL grammar uses a syntax similar to Extended Backus-Naur Form (EBNF). Table 10.1, “Massiv IDL EBNF” lists the symbol used in the grammar and their meaning.

Table 10.1. Massiv IDL EBNF
SymbolMeaning
::=Is defined to be
|Alternative
<text>Nonterminal
"text"Literal
*Repeat zero or more times
+Repeat one or more times
{}Group of several syntactic units
[]Optional syntactic unit

The complete grammar follows. Note that it's not 100% correct everywhere. For example, all assignments are strongly typed in IDL, type of the expression that can appear on the right side of the assignment operator is determined by the type of object on the left side of the operator.


 (1)                  <idl> ::= <definition>*
 (2)           <definition> ::= <namespace>
                              | <enum>
                              | <attribute>
                              | <attr_default>
                              | <class>
                              | <include_header>
                              | ";"
 (3)            <namespace> ::= "namespace"
                                <identifier>
                                "{" <definition>* "}"
 (4)                 <enum> ::= "enum"
                                <identifier>
                                "{" <enum_body> "}"
 (5)            <enum_body> ::= <enumerator>
                                { "," <enumerator> }*
                                [ "," ]
 (6)           <enumerator> ::= <identifier>
                                "="
                                <int_expr>
 (7)            <attribute> ::= <attr_kind>
                                <attr_type>
                                <identifier>
                                "="
                                <const_expr>
                                ";"
 (8)            <attr_kind> ::= <classattr_dcl>
                              | <propattr_dcl>
                              | <methodattr_dcl>
 (9)        <classattr_dcl> ::= "classattr"
                                [ "<" [ <classattr_flags> ] ">" ]
(10)      <classattr_flags> ::= <classattr_flag>
                                { "," <classattr_flag> }*
(11)       <classattr_flag> ::= "inherit"
                              | "idl_internal"
(12)         <propattr_dcl> ::= "propattr"
                                [ "<" [ <propattr_flags> ] ">" ]
(13)       <propattr_flags> ::= <propattr_flag>
                                { "," <propattr_flag> }*
(14)        <propattr_flag> ::= "idl_internal"
(15)       <methodattr_dcl> ::= "methodattr"
                                [ "<" [ <methodattr_flags> ] ">" ]
(16)     <methodattr_flags> ::= <methodattr_flag>
                                { "," <methodattr_flag> }*
(17)      <methodattr_flag> ::= "idl_internal"
(18)            <attr_type> ::= <buildin_type>
                              | <enum_name>
(19)         <buildin_type> ::= "bool"
                              | "int"
                              | "string"
(20)            <enum_name> ::= <scoped_name>
(21)          <scoped_name> ::= <identifier>
                              | "::" <identifier>
                              | <scoped_name> "::" <identifier>
(22)         <attr_default> ::= "attribute"
                                <attr_name>
                                "="
                                <const_expr>
                                ";"
(23)            <attr_name> ::= <scoped_name>
(24)                <class> ::= <class_fwd>
                              | <class_dcl>
(25)            <class_fwd> ::= "class"
                                <identifier>
                                ";"
(26)            <class_dcl> ::= <class_header>
                                "{" <class_body> "}"
(27)         <class_header> ::= "class"
                                [ "<" [ <classattr_vals> ] ">" ]
                                <identifier>
                                [ <class_inheritance> ]
(28)       <classattr_vals> ::= <classattr_val>
                                { "," <classattr_val> }*
(29)        <classattr_val> ::= <boolclassattr_name>
                              | <classattr_name> "=" <const_expr>
(30)   <boolclassattr_name> ::= <scoped_name>
(31)       <classattr_name> ::= <scoped_name>
(32)    <class_inheritance> ::= ":"
                                <base_class_name>
                                { "," <base_class_name> }*
(33)      <base_class_name> ::= [ "virtual" ] <class_name>
(34)           <class_name> ::= <scoped_name>
(35)           <class_body> ::= <in_class>*
(36)             <in_class> ::= <enum>
                              | <attr_default>
                              | <class>
                              | <property>
                              | <method>
                              | ";"
(37)             <property> ::= "property"
                                [ "<" [ <propattr_vals> ] ">" ]
                                <type>
                                <identifier>
                                ";"
(38)        <propattr_vals> ::= <propattr_val>
                                { "," <propattr_val> }*
(39)         <propattr_val> ::= <boolpropattr_name>
                              | <propattr_name> "=" <const_expr>
(40)    <boolpropattr_name> ::= <scoped_name>
(41)        <propattr_name> ::= <scoped_name>
(42)                 <type> ::= <stype>
                              | <array_type>
                              | <class_type>
                              | <dictionary_type>
                              | <event_type>
                              | <pair_type>
                              | <pointer_type>
                              | <set_type>
(43)                <stype> ::= <bool_type>
                              | <color_type>
                              | <enum_type>
                              | <float_type>
                              | <floatq_type>
                              | <int_type>
                              | <orientation_type>
                              | <string_type>
                              | <time_type>
                              | <vector_type>
                              | <vlint_type>
(44)            <bool_type> ::= "bool"
(45)           <color_type> ::= "color"
(46)            <enum_type> ::= <enum_name>
(47)           <float_type> ::= float32
                              | float64
(48)          <floatq_type> ::= { floatq32 | floatq64 }
                                "<" <floatq_traits> ">"
(49)        <floatq_traits> ::= <string_literal>
(50)             <int_type> ::= <bitint_type>
                                [ "<" <bit_width> ">" ]
(51)          <bitint_type> ::= int8
                              | int16
                              | int32
                              | int64
                              | uint8
                              | uint16
                              | uint32
                              | uint64
(52)            <bit_width> ::= <int_expr>
(53)     <orientation_type> ::= "orientation"
(54)          <string_type> ::= "string"
(55)            <time_type> ::= "time"
(56)          <vector_type> ::= "vector2"
                              | "vector3"
(57)           <vlint_type> ::= vlint8
                              | vlint16
                              | vlint32
                              | vlint64
                              | vluint8
                              | vluint16
                              | vluint32
                              | vluint64
(58)           <array_type> ::= <parray_type>
                              | <varray_type>
(59)          <parray_type> ::= "property_array"
                                "<" <type> ">"
(60)          <varray_type> ::= "value_array"
                                "<" <stype> ">"
(61)           <class_type> ::= <class_name>
(62)      <dictionary_type> ::= <dictionary_kind>
                                "<" <dictkey_type> "," <dictvalue_type> ">"
(63)      <dictionary_kind> ::= "dictionary"
                              | "multi_dictionary"
(64)         <dictkey_type> ::= <type>
(65)       <dictvalue_type> ::= <type>
(66)           <event_type> ::= "event_handle"
(67)            <pair_type> ::= "pair"
                                "<" <pairvalue_type> "," <pairvalue_type> ">"
(68)       <pairvalue_type> ::= <type>
(69)         <pointer_type> ::= <pointer_kind>
                                "<" <class_name> ">"
(70)         <pointer_kind> ::= "strong_pointer"
                              | "weak_pointer"
                              | "remote_pointer"
(71)             <set_type> ::= <set_kind>
                                "<" <setvalue_type> ">"
(72)             <set_kind> ::= "set"
                              | "multi_set"
(73)        <setvalue_type> ::= <type>
(74)               <method> ::= "method"
                                [ "<" [ <methodattr_vals> ] ">" ]
                                <identifier>
                                "("
                                [ <arguments> ]
                                ")"
                                [ <return_spec> ]
                                ";"
(76)      <methodattr_vals> ::= <methodattr_val>
                                { "," <methodattr_val> }*
(77)       <methodattr_val> ::= <boolmethodattr_name>
                              | <methodattr_name> "=" <const_expr>
(78)  <boolmethodattr_name> ::= <scoped_name>
(79)      <methodattr_name> ::= <scoped_name>
(80)            <arguments> ::= <argument>
                                { "," <argument> }*
(81)             <argument> ::= <pass_semantics>
                                <type>
                                <identifier>
(82)       <pass_semantics> ::= "in"
                              | "out"
                              | "inout"
(83)          <return_spec> ::= ":"
                                <type>
(84)       <include_header> ::= "include_header"
                                <string_literal>
                                ";"
(85)           <const_expr> ::= <bool_expr>
                              | <int_expr>
                              | <string_expr>
                              | <enum_expr>
(86)            <bool_expr> ::= <bool_literal>
(87)         <bool_literal> ::= "0"
                              | "1"
                              | "true"
                              | "false"
(88)             <int_expr> ::= "-"*
                                <int_literal>
(89)          <string_expr> ::= <string_literal>
(90)            <enum_expr> ::= <identifier>

The grammar of literal nonterminals (<int_literal> and <string_literal>) is not included as they were already described. Note that neither float nor character literals are currently used by the IDL.