[ Previous document | Content Table | Next document ]

21    UNOIDL Syntax Specification

The following listing comprises the language specification for UNOIDL in pseudo BNF notation.

  1. <idl_specification> := <definition>+

  2. <definition> := <type_decl> ";"
                  | <module_decl> ";"
                  | <constant_decl> ";"
                  | <exception_decl> ";"
                  | <constants_decl> ";"
                  | <service_decl> ";"
                  | <singleton_decl> ";"

  3. <type_decl> := <interface_spec>
                 | <constr_type_spec>
                 | "typedef" <simple_type_spec> <declarator> { "," <declarator> }*

  4. <interface_spec> := <interface_decl>
                       | <forward_decl>

  5. <forward_decl> := "interface" <identifier>

  6. <interface_decl> := <interface_header> "{" <interface_body> "}"

  7. <interface_header> := "interface" <identifier> [ <interface_inheritance> ]

  8. <interface_inheritance> := ":" <interface_name>

  9. <interface_name> := <scoped_name>

  10. <scoped_name> := [ "::" ] { <identifier> "::" }* <identifier>

  11. <interface_body> := <export>+

  12. <export> := <attribute_decl> ";"
               | <operation_decl> ";"

  13. <operation_decl> := [ <operation_head> ] { <simple_type_spec> | "void" } <identifier>
                        "(" [ <operation_parameters> ] ")" [ <operation_exceptions> ]

  14. <operation_head> := "[" "oneway" "]"

  15. <operation_parameters> := <parameter_decl> { "," <parameter_decl> }*

  16. <parameter_decl> := "[" <parameter_direction> "]" <simple_type_spec> <identifier>

  17. <parameter_direction> := "in" | "out" | "inout"

  18. <operation_exceptions> := raises "(" <exception_name> { "," <exception_name> }* ")"

  19. <exception_name> := <scoped_name>

  20. <attribute_decl> := <attribute_head> <simple_type_spec> <declarator> { "," <declarator> }*

  21. <attribute_head> := "[" ["readonly" ","] "attribute" "]"
                       | "[" "attribute" ["," "readonly"] "]"

  22. <declarator> := <identifier>
                   | <array_declarator>

  23. <array_declarator> := <identifier> <array_size>+

  24. <array_size> := "[" <positive_int> "]"

  25. <positive_int> := <const_expr>

  26. <type_spec> := <simple_type_spec>
                  | <constr_type_spec>

  27. <simple_type_spec> := <base_type_spec>
                         | <template_type_spec>
                         | <scoped_name>

  28. <base_type_spec> := <integer_type>
                       | <floating_point_type>
                       | <char_type>
                       | <byte_type>
                       | <boolean_type>
                       | <string_type>
                       | <any_type>
                       | <type_type>

  29. <template_type_spec> := <sequence_type>
                           | <array_type>

  30. <sequence_type> := "sequence" "<" <simple_type_spec> ">"

  31. <array_type> := <simple_type_spec> <array_size>+

  32. <floating_point_type> := "float"
                            |
    "double"

  33. <integer_type> := <signed_int>

                      | <unsinged_int>

  34. <signed_int> := "short"
                   | "long"
                   | "hyper"

  35. <unsigned_int> := "unsigned" "short"
                     | "unsigned" "long"
                     | "unsigned" "hyper"

  36. <char_type> := "char"

  37. <type_type> := "type"

  38. <string_type> := "string"

  39. <byte_type> := "byte"

  40. <any_type> := "any"

  41. <boolean_type> := "boolean"

  42. <constr_type_spec> := <struct_decl>
                            | <enum_decl>
                            | <union_decl>

  43. <struct_decl> := "struct" <identifier> [ <struct_inheritance> ] "{" <member>+ "}"

  44. <struct_inheritance> := ":" <scoped_name>

     

  45. <member> := <simple_type_spec> <declarator> { "," <declarator> }* ";"

  46. <enum_decl> := enum <identifier> "{" <enumerator> { "," <enumerator> }* "}"

  47. <enumerator> := <identifier> [ "=" <const_expr> ]

     

  48. <union_decl> := "union" <identifier> "switch" "(" <switch_type_spec> ")"
                   "{" <switch_body> "}"

     

  49. <switch_type_spec> := <integer_type>
                         | <scoped_name>

  50. <switch_body> := <case>+

  51. <case> := <case_label> <element_spec> ";"

  52. <case_label> := "case" <const_expr> ":"
                   | "default" ":";

  53. <element_spec> := <simple_type_spec> <declarator>

  54. <exception_decl> := "exception" <identifier> [ <exception_inheritance> ] "{" <member>* "}"

  55. <exception_inheritance> := ":" <scoped_name>

     

  56. <module_decl> := "module" <identifier> "{" <definition>+ "}"

  57. <constant_decl> := "const" <const_type> <identifier> "=" <const_expr>

  58. <const_type> := <integer_type>
                   | <char_type>
                   | <boolean_type>
                   | <floating_point_type>
                   | <string_type>
                   | <scoped_name>

  59. <const_expr> := <or_expr>

  60. <or_expr> :=        <xor_expr>
                | <or_expr> "|" <xor_expr>

  61. <xor_expr> := <and_expr>
                 | <xor_expr> "^" <and_expr>

  62. <and_expr> := <shift_expr>
                 | <and_expr> "&" <shift_expr>

  63. <shift_expr> := <add_expr>
                   | <shift_expr ">>" <add_expr>
                   | <shift_expr "<<" <add_expr>

  64. <add_expr> := <mult_expr>
                 | <add_expr> "+" <mult_expr>
                 | <add_expr> "-" <mult_expr>

  65. <mult_expr> := <unary_expr>
                  | <mult_expr> "*" <unary_expr>
                  | <mult_expr> "/" <unary_expr>
                  | <mult_expr> "%" <unary_expr>

  66. <unary_expr> := <unary_operator> <primary_expr>
                   | <primary_expr>

  67. <unary_operator> := "-" | "+" | "~"

  68. <primary_expr> := <scoped_name>
                     | <literal>
                     | "(" <const_expr> ")"

  69. <literal> := <integer_literal>
                | <string_literal>
                | <character_literal>
                | <floating_point_literal>
                | <boolean_literal>

  70. <boolean_literal> := "TRUE" | "True" | "FALSE" | "False"

  71. <service_decl> := "service" <identifier> "{" <service_member>+ "}"

  72. <singleton_decl> := "singleton" <identifier> "{" "service" <scoped_name> ";"  "}"

  73. <service_member> := <property_decl> ";"
                       | <support_decl> ";"
                       | <export_decl> ";"
                       | <observe_decl> ";"
                       | <needs_decl> ";"

  74. <property_decl> := <property_head> <simple_type_spec> <declarator> { "," <declarator> }*

  75. <property_head> := "[" {<property_flags> ","}* "property" "]"
                      | "[" "property" {"," <property_flags>}* "]"

  76. <property_flags> := "readonly"
                       | "bound"
                       | "constrained"
                       | "maybeambigious"
                       | "maybedefault"
                       | "maybevoid"
                       | "optional"
                       | "removable"
                       | "transient"

     

  77. <support_decl> := [ "[" "optional" "]" ] "interface" <scoped_name> { "," <scoped_name> }*

  78. <export_decl> := [ "[" "optional" "]" ] "service" <scoped_name> { "," <scoped_name> }*

     

  79. <observe_decl> := "observe" <scoped_name> { "," <scoped_name> }*

  80. <needs_decl> := "needs" <scoped_name> { "," <scoped_name> }*

  81. <constants_decl> := "constants" <identifier> "{" <constant_decl>+ "}"

[ Previous document | Content Table | Next document ]