## IDL Grammar Synopsis

This topic summarizes IDL syntax, in extended Backus-Naur Format (BNF) notation.

<interface> ::= <interface_header> "{" <interface_body> "}"

<interface_header> ::=

"[" <interface_attributes> "]" "interface" <identifier> [ ":" <identifier> ]

<interface_attributes> ::=

<interface_attribute> [ "," <interface_attribute> ] ...

<interface_attribute> ::= "uuid" "(" <uuid_rep> ")"

| "version" "(" <major> [ "." <minor> ] ")"

| "endpoint" "(" <endpoint_spec> [ "," <endpoint_spec> ] ... ")"

| "pointer_default" "(" <pointer_attribute> ")"

| "local"

| "exceptions" "(" <excep_name> ["," <excep_name>] ... ")"

<excep_name> ::= <Identifier>

<major> ::= <integer>

<minor> ::= <integer>

<endpoint_spec> ::=

""" <family_string> ":" "[" <endpoint_string> "]" """

<family_string> ::= <identifier>

<endpoint_string> ::= <identifier>

<interface_body> ::= [ <import> ] ... [ <export> ] ...

<export> ::= <const_declaration> ";"

| <type_declaration> ";"

| <op_declaration> ";"

<import> ::= import <import_files> ";"

<import_files> ::= <filename> [ "," <filename> ] ... ";"

<filename> ::= """ <character> ... """

<const_declaration> ::=

"const" <const_type_spec> <identifier> "=" <const_exp>

<const_type_spec> ::=

<integer_type> | "char" | "char" "*" | "boolean" | "void" "*"

<const_exp> ::=

<integer_const_exp> | <character_const> | <string_const>

| <identifier> | "TRUE" | "FALSE" | "NULL"

<integer_const_exp> ::= <conditional_exp>

<conditional_exp> ::= <logical_or_exp>

| <logical_or_exp> "?" <integer_const_exp> ":" <conditional_exp>

<logical_or_exp> ::= <logical_and_exp>

| <logical_or_exp> "||" <logical_and_exp>

<logical_and_exp> ::= <inclusive_or_exp>

| <logical_and_exp> "&&" <inclusive_or_exp>

<inclusive_or_exp> ::= <exclusive_or_exp>

| <inclusive_or_exp> "|" <exclusive_or_exp>

<exclusive_or_exp> ::= <and_exp>

| <and_exp> "^" <and_exp>

<and_exp> ::= <equality_exp>

| <and_exp> "&" <equality_exp>

<equality_exp> ::= <relational_exp>

| <equality_exp> "==" <relational_exp>

| <equality_exp> "!=" <relational_exp>

<relational_exp> ::= <shift_exp>

| <relational_exp> "<" <shift_exp>

| <relational_exp> ">" <shift_exp>

| <relational_exp> "<=" <shift_exp>

| <relational_exp> ">=" <shift_exp>

<shift_exp> ::= <additive_exp>

| <shift_exp> "<<" <additive_exp>

| <shift_exp> ">>" <additive_exp>

<additive_exp> ::= <multiplicative_exp>

| <additive_exp> "+" <multiplicative_exp>

| <additive_exp> "-" <multiplicative_exp>

<multiplicative_exp> ::= <unary_exp>

| <multiplicative_exp> "*" <unary_exp>

| <multiplicative_exp> "/" <unary_exp>

| <multiplicative_exp> "%" <unary_exp>

<unary_exp> ::= <primary_exp>

| "+" <primary_exp>

| "-" <primary_exp>

| "~" <primary_exp>

| "!" <primary_exp>

<primary_exp> ::= <integer_literal>

| <identifier>

<character_const> ::= "'" <character> "'"

<string_const> ::= """ [ <character> ] ... """

<type_declaration> ::=

"typedef" [ <type_attributes> ] <type_spec> <declarators>

<type_spec> ::= <simple_type_spec>

| <constructed_type_spec>

<simple_type_spec> ::= <base_type_spec>

| <predefined_type_spec>

| <identifier>

<declarators> ::= <declarator> [ "," <declarator> ] ...

<declarator> ::= <simple_declarator>

| <complex_declarator>

<simple_declarator> ::= <identifier>

<complex_declarator> ::= <array_declarator>

| <function_ptr_declarator>

| <ptr_declarator>

| <ref_declarator>

<ref_declarator> ::= "&" <identifier>

<tagged_declarator> ::= <tagged_struct_declarator>

| <tagged_union_declarator>

<base_type_spec> ::= <integer_type>

| <floating_type>

| <char_type>

| <boolean_type>

| <byte_type>

| <void_type>

| <handle_type>

<floating_type> ::= "float" | "double"

<integer_type> ::= <signed_int> | <unsigned_int>

<signed_int> ::= <int_size> [ "int" ]

<unsigned_int> ::= <int_size> "unsigned" [ "int" ]

| "unsigned" <int_size> [ "int" ]

<int_size> ::= "hyper" | "long" | "short" | "small"

<char_type> ::= [ "unsigned" ] "char"

<boolean_type> ::= "boolean"

<byte_type> ::= "byte"

<void_type> ::= "void"

<handle_type> ::= "handle_t"

<constructed_type_spec> ::= <struct_type>

| <union_type>

| <tagged_declarator>

| <enumeration_type>

| <pipe_type>

<tagged_struct_declarator> ::= "struct" <tag>

| <tagged_struct>

<struct_type> ::= "struct" "{" <member_list> "}"

<tagged_struct> ::= "struct" <tag> "{" <member_list> "}"

<tag> ::= <identifier>

<member_list> ::= <member> [ <member> ] ...

<member> ::= <field_declarator> ";"

<field_declarator> ::= [ <field_attribute_list> ]

<type_spec> <declarators>

<field_attribute_list> ::= "[" <field_attribute> [ ","

<field_attribute>] ... "]"

<tagged_union_declarator> ::= "union" <tag>

| <tagged_union>

<union_type> ::= "union" <union_switch> "{" <union_body> "}"

| "union" "{" <union_body_n_e> "}"

<union_switch> ::= "switch" "(" <switch_type_spec> <identifier> ")"

[ <union_name> ]

.ne 6

<switch_type_spec> ::= <integer_type>

| <char_type>

| <boolean_type>

| <enumeration_type>

<tagged_union_declarator> ::= "union" <tag>

| <tagged_union>

<union_type> ::= "union" <union_switch> "{" <union_body> "}"

| "union" "{" <union_body_n_e> "}"

<union_switch> ::= "switch" "(" <switch_type_spec> <Identifier> ")" \\

[ <union_name> ]

<switch_type_spec> ::= <primitive_integer_type>

| <char_type>

| <boolean_type>

| <enumeration_type>

<tagged_union> ::= "union" <tag> <union_switch> "{" <union_body> "}"

| "union" <tag> "{" <union_body_n_e> "}"

<union_name> ::= <Identifier>

<union_body> ::= <union_case> [ <union_case> ] ...

<union_body_n_e> ::= <union_case_n_e> [ <union_case_n_e> ] ...

<union_case> ::= <union_case_label> [ <union_case_label> ] ... <union_arm>

| <default_case>

<union_case_n_e> ::= <union_case_label_n_e> <union_arm>

| <default_case_n_e>

<union_case_label> ::= "case" <const_exp> ":"

<union_case_label_n_e> ::= "[" "case" "(" <const_exp> \\

[ , <const_exp>] ...")" "]"

<default_case> ::= "default" ":" <union_arm>

<default_case_n_e> ::= "[" "default" "]" <union_arm>

<union_arm> ::= [ <field_declarator> ] ";"

<union_type_switch_attr> ::= "switch_type" "(" <switch_type_spec> ")"

<union_instance_switch_attr> ::= "switch_is" "(" <attr_var> ")"

<enumeration_type> ::=

."enum" "{" <enum_identifier> [ "," <enum_identifier> ] ... "}"

<enum_identifier> ::= <identifier> [ "=" <const_exp> ]

<pipe_type> ::= "pipe" <type_spec> <pipe_declarators>

<array_declarator> ::= <identifier> <array_bounds_list>

<array_bounds_list> ::= <array_bounds_declarator>

[ <array_bounds_declarator> ] ...

<array_bounds_declarator> ::= "[" [ <array_bound> ] "]"

| "[" <array_bounds_pair> "]"

<array_bounds_pair> ::= <array_bound> ".." <array_bound>

<array_bound> ::= "*"

| <integer_literal>

| <identifier>

<type_attribute> ::= "transmit_as" "(" <xmit_type> ")"

| "handle"

| <usage_attribute>

| <union_type_switch_attr>

| <ptr_attr>

<usage_attribute> ::= "string"

| "context_handle"

<xmit_type> ::= <simple_type_spec>

<field_attribute> ::= "first_is" "(" <attr_var_list> ")"

| "last_is" "(" <attr_var_list> ")"

| "length_is" "(" <attr_var_list> ")"

| "max_is" "(" <attr_var_list> ")"

| "min_is" "(" <attr_var_list> ")"

| "size_is" "(" <attr_var_list> ")"

| <usage_attribute>

| <union_instance_switch_attr>

| "ignore"

| <ptr_attr>

<attr_var_list> ::= <attr_var> [ "," <attr_var> ] ...

<attr_var> ::= [ ["*"]<identifier> ]

<ptr_declarator> ::= "*"<identifier>

<ptr_attr> ::= "ref"

| "unique"

| "full"

<op_declarator> ::= [ <operation_attributes> ]

<simple_type_spec> <identifier> <parameter_declarators>

<operation_attributes> ::= "[" <operation_attribute> [ "static" ]

[ "," <operation_attribute> ] ... "]"

<operation_attribute> ::= "idempotent"

| "broadcast"

| "maybe"

| "reflect_deletions"

| <usage_attribute>

| <ptr_attr>

<param_declarators> ::= "(" "void" ")"

| "(" [ <param_declarator> [ "," <param_declarator> ] ... ] ")"

<param_declarator> ::= <param_attributes> <type_spec> <declarator>

<param_attributes> ::=

"[" <param_attribute> [ "," <param_attribute> ] ... "]"

<param_attribute> ::= <directional_attribute>

| <field_attribute>

<directional_attribute> ::= "in" [ "(" "shape" ")" ]

| "out" [ "(" "shape" ")" ]

<function_ptr_declarator> ::= <simple_type_spec>

"(" "*"<identifier> ")" <param_declarators>

<predefined_type_spec> ::= "error_status_t"

| <international_character_type>

<international_character_type> ::= ISO_LATIN_1

| ISO_MULTI_LINGUAL

| ISO_UCS

<pipe_declarators> ::= <pipe_declarator> [ "," <pipe_declarator> ] ...

<pipe_declarator> ::= <simple_declarator>

| <ptr_declarator>

| <ref_declarator>

##