This is a "fair use" extraction of the CORBA 3.0 IDL specification, which I used as a starting point for CIDL. CIDL is _much_ simpler than this, but I tried to be similar to this, and use as many of the same non-terminal names as made sense. 3.4 OMG IDL Grammar (1) ::= * + (2) ::= ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" (3) ::= "module" "{" + "}" (4) ::= | (5) ::= "{" "}" (6) ::= [ "abstract" | "local" ] "interface" (7) ::= [ "abstract" | "local" ] "interface" [ ] (8) ::= * (9) ::= ";" | ";" | ";" | ";" | ";" | ";" | ";" (10)::=":" { "," }* (11) ::= (12) ::= | "::" | "::" (13) ::= ( | | | ) (14) ::= [ "abstract" ] "valuetype" (15) ::= "valuetype" (16) ::= "abstract" "valuetype" [ ] "{" * "}" (17) ::= "{" < value_element>* "}" (18) ::= ["custom" ] "valuetype" [ ] (19) ::= [ ":" [ "truncatable" ] { "," }* ] [ "supports" { "," }* ] (20) ::= (21) ::= | < state_member> | (22) ::= ( "public" | "private" ) ";" (23) ::= "factory" "(" [ ] ")" [ ] ";" (24) ::= { "," }* (25) ::= (26) ::= "in" (27) ::= "const" "=" (28) ::= | | | | | | | | | (29) ::= (30) ::= | "|" (31) ::= | "^" (32) ::= | "&" (33) ::= | ">>" | "<<" (34) ::= | "+" | "-" (35) ::= | "*" | "/" | "%" (36) ::= | (37) ::= "-" | "+" | "~" (38) ::= | | "(" ")" (39) ::= | | | | | | | (40) ::= "TRUE" | "FALSE" (41) ::= (42) ::= "typedef" | | | | "native" | (43) ::= (44) ::= | (45) ::= | | (46) ::= | | | | | | | | (47) ::= | | | (48) ::= | | (49) ::= { "," } (50) ::= | (51) ::= (52) ::= (53) ::= "float" | "double" | "long" "double" (54) ::= | (55) ::= | | (56) ::= "short" (57) ::= "long" (58) ::= "long" "long" (59) ::= | | (60) ::= "unsigned" "short" (61) ::= "unsigned" "long" (62) ::= "unsigned" "long" "long" (63) ::= "char" (64) ::= "wchar" (65) ::= "boolean" (66) ::= "octet" (67) ::= "any" (68) ::= "Object" (69) ::= "struct" "{" "}" (70) ::= + (71) ::= ";" (72) ::= "union" "switch" "(" ")" "{" "}" (73) ::= | | | | (74) ::= + (75) ::= + ";" (76) ::= "case" ":" | "default" ":" (77) ::= (78) ::= "enum" "{" { "," } "}" (79) ::= (80) ::= "sequence" "<" "," ">" | "sequence" "<" ">" (81) ::= "string" "<" ">" | "string" (82) ::= "wstring" "<" ">" | "wstring" (83) ::= + (84) ::= "[" "]" (85) ::= | (86) ::= "exception" "{" * "}" (87) ::= [ ] [ ] [ ] (88) ::= "oneway" (89) ::= | "void" (90) ::= "(" { "," } ")" | "(" ")" (91) ::= (92) ::= "in" | "out" | "inout" (93) ::= "raises" "(" { "," } ")" (94) ::= "context" "(" { "," } ")" (95) ::= | | | (96) ::= "fixed" "<" "," ">" (97) ::= "fixed" (98) ::= "ValueBase" (99) ::= "struct" | "union" (100) ::= "import" ";" (101) ::= | (102) ::= "typeid" (103) ::= "typeprefix" (104) ::= "readonly" "attribute" (105)::= | { "," }* (106) ::= "attribute" (107) ::= | { "," }* (108) ::= [ ] | (109) ::= "getraises" (110) ::= "setraises" (111) ::= "(" { "," } ")" * Note ­ Grammar rules 1 through 111 with the exception of the last three lines of rule 2 constitutes the portion of IDL that is not related to components. (112) ::= | (113)::= "component" (114) ::= "{" "}" (115) ::= "component" [ ] [ ] (116)::= "supports" { "," }* (117)::= ":" (118) ::= * (119) ::= ";" | ";" | ";" | ";" | ";" | ";" (120) ::= "provides" (121) ::= | "Object" (122) ::= "uses" [ "multiple" ] < interface_type> (123) ::= "emits" (124) ::= "publishes" (125) ::= "consumes" (126) ::= (127) ::= "home" [ ] [ ] "manages" [ ] (128) ::= ":" (129) ::= "primarykey" (130) ::= "{" * "}" (131) | ";" | ";" (132) ::= "factory" "(" [ ] ")" [ ] (133) ::= "finder" "(" [ ] ")" [ ] (134) ::= ( | | ) (135) ::= [ "abstract" ] "eventtype" (136) ::= "abstract" "eventtype" [ ] "{" * "}" (137) ::= "{" * "}" (138) ::= [ "custom" ] "eventtype" [ ] 3.5 OMG IDL Specification An OMG IDL specification consists of one or more type definitions, constant definitions, exception definitions, or module definitions. The syntax is: (1) ::= * + (2) ::= ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" | ";" See Section 3.6, "Import Declaration," on page 3-19, for the specification of . See Section 3.7, "Module Declaration," on page 3-20, for the specification of . See Section 3.8, "Interface Declaration," on page 3-20, for the specification of . See Section 3.9, "Value Declaration," on page 3-27, for the specification of . See Section 3.10, "Constant Declaration," on page 3-32, Section 3.11, "Type Declaration," on page 3-36, and Section 3.12, "Exception Declaration," on page 3-49 respectively for specifications of , , and . See Section 3.15, "Repository Identity Related Declarations," on page 3-55, for specification of Repository Identity declarations which include and . See Section 3.16, "Event Declaration," on page 3-57, for specification of . See Section 3.17, "Component Declaration," on page 3-58, for specification of . See Section 3.18, "Home Declaration," on page 3-63, for specification of . 3.13 Operation Declaration Operation declarations in OMG IDL are similar to C function declarations. The syntax is: (87) ::= [ ] [ ] [ ] (88) ::= "oneway" (89) ::= | "void" An operation declaration consists of: · An optional operation attribute that specifies which invocation semantics the communication system should provide when the operation is invoked. Operation attributes are described in Section 3.13.1, "Operation Attribute," on page 3-51. · The type of the operation's return result; the type may be any type that can be defined in OMG IDL. Operations that do not return a result must specify the void type. · An identifier that names the operation in the scope of the interface in which it is defined. · A parameter list that specifies zero or more parameter declarations for the operation. Parameter declaration is described in Section 3.13.2, "Parameter Declarations," on page 3-51. · An optional raises expression that indicates which exceptions may be raised as a result of an invocation of this operation. Raises expressions are described in Section 3.13.3, "Raises Expressions," on page 3-52. · An optional context expression that indicates which elements of the request context may be consulted by the method that implements the operation. Context expressions are described in Section 3.13.4, "Context Expressions," on page 3-53. Some implementations and/or language mappings may require operation-specific pragmas to immediately precede the affected operation declaration. 3.13.1 Operation Attribute The operation attribute specifies which invocation semantics the communication service must provide for invocations of a particular operation. An operation attribute is optional. The syntax for its specification is as follows: (88) ::= "oneway" When a client invokes an operation with the oneway attribute, the invocation semantics are best-effort, which does not guarantee delivery of the call; best-effort implies that the operation will be invoked at most once. An operation with the oneway attribute must not contain any output parameters and must specify a void return type. An operation defined with the oneway attribute may not include a raises expression; invocation of such an operation, however, may raise a standard system exception. If an is not specified, the invocation semantics is at-most-once if an exception is raised; the semantics are exactly-once if the operation invocation returns successfully. 3.13.2 Parameter Declarations Parameter declarations in OMG IDL operation declarations have the following syntax: (90) ::= "(" { "," } ")" | "(" ")" (91) ::= (92) ::= "in" | "out" | "inout" (95) ::= | | | A parameter declaration must have a directional attribute that informs the communication service in both the client and the server of the direction in which the parameter is to be passed. The directional attributes are: · in - the parameter is passed from client to server. · out - the parameter is passed from server to client. · inout - the parameter is passed in both directions. It is expected that an implementation will not attempt to modify an in parameter. The ability to even attempt to do so is language-mapping specific; the effect of such an action is undefined. If an exception is raised as a result of an invocation, the values of the return result and any out and inout parameters are undefined. 3.13.3 Raises Expressions There are two kinds of raises expressions as described in this section. 3.13.3.1 Raises Expression A raises expression specifies which exceptions may be raised as a result of an invocation of the operation or accessing (invoking the _get operation of) a readonly attribute. The syntax for its specification is as follows: (93) ::= "raises" "(" { "," } ")" The s in the raises expression must be previously defined exceptions or native types. If a native type is used as an exception for an operation, the operation must appear in either a local interface or a valuetype. In addition to any operation-specific exceptions specified in the raises expression, there are a standard set of system exceptions that may be signalled by the ORB. These standard system exceptions are described in Section 4.12.3, "Standard System Exception Definitions," on page 4-66. However, standard system exceptions may not be listed in a raises expression. The absence of a raises expression on an operation implies that there are no operation-specific exceptions. Invocations of such an operation are still liable to receive one of the standard system exceptions. 3.13.3.2 getraises and setraises Expressions getraises and setraises expressions specify which exceptions may be raised as a result of an invocation of the accessor (_get) and a mutator (_set) functions of an attribute. The syntax for its specification is as follows: (108) ::= [ ] | (109) ::= "getraises" (110) ::= "setraises" (111) { "," } ")" * The s in the getraises and setraises expressions must be previously defined exceptions. 3.14 Attribute Declaration An interface can have attributes as well as operations; as such, attributes are defined as part of an interface. An attribute definition is logically equivalent to declaring a pair of accessor functions; one to retrieve the value of the attribute and one to set the value of the attribute. The syntax for attribute declaration is: (85) ::= | (104) ::= "readonly" "attribute" (105)::= | { "," }* (106) ::= "attribute" (107) ::= | { "," }* The optional readonly keyword indicates that there is only a single accessor function--the retrieve value function. Consider the following example: interface foo { enum material_t {rubber, glass}; struct position_t { float x, y; }; attribute float radius; attribute material_t material; readonly attribute position_t position; · · · }; The attribute declarations are equivalent to the following pseudo-specification fragment, assuming that one of the leading `_'s is removed by application of the Escaped Identifier rule described in Section 3.2.3.1, "Escaped Identifiers," on page3-7: · · · float __get_radius (); void __set_radius (in float r); material_t __get_material (); void __set_material (in material_t m); position_t __get_position (); · · · The actual accessor function names are language-mapping specific. The attribute name is subject to OMG IDL's name scoping rules; the accessor function names are guaranteed not to collide with any legal operation names specifiable in OMG IDL. Attributes are inherited. An attribute name cannot be redefined to be a different type. See Section 3.19, "CORBA Module," on page 3-66 for more information on redefinition constraints and the handling of ambiguity.