The Free and Open Productivity Suite
Follow us on Twitter: @ApacheOO

OpenOfficeUnoidl syntax description


Contents

Introduction
Keywords
Basetypes
Comments
Array

Union

Introduction

The unoidl is an idl language (interface description language) which is similar to the corba idl. Idl is a language to describe interfaces and types independently of any programming language and hardware platform. An idl description is used by the idl compiler to generate code for these interfaces in a selected target language. The generated code provides the use of the described interfaces in the selected target language. The mapping of the idl description to the target language was defined in an appropriate language binding.

All possible idl definitions will be described now. The reader who is intimate in C++ programming will see, that the syntax of the idl is similar to the C++ syntax. Because the lexical conventions of the idl and the structure of the definitions have a large degree with the ANSI standard for C++.

Keywords

The following table shows all keywords of the unoidl. All the keywords are reserved and cannot be used as an identifier.

any attribute boolean bound byte case
char const constants constrained default double

enum

exception float

hyper

in

inout

interface

long

maybeambigious

maybedefault

maybevoid

module

needs

observes

oneway

optional

out

property

raises readonly removable sequence service short
string struct switch transient type typedef
union unsigned void FALSE False TRUE
True          

IDL language specification

Definition:

(1) <idl_specification> := <definition>+

(2) <definition> := <type_decl> ";"
                    | <module_decl> ";"
                    | <constant_decl> ";"
                    | <exception_decl> ";"
                    | <constants_decl> ";"
                    | <service_decl> ";"

(3) <type_decl> := <interface>
                   | <struct_decl>
                   | <enum_decl>
                   | <union_decl>
                   | "typedef" <type_spec> <declarator> {"," <declarator> }* 

(4) <interface> := <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>
                      | "::" <scoped_name>
                      | <scoped_name> "::" <identifier>

(11) <interface_body> := <export>+

(12) <export> := <attribute_decl> ";"
                 | <operation_decl> ";"

(13) <attribute_decl> := <attribute_head> <type_spec> <declarator> { "," <declarator> }*

(14) <attribute_head> := "[" ["readonly" ","] "attribute" "]"
                         | "[" "attribute" ["," "readonly"] "]"


(15) <declarator> := <identifier>
                     | <array_declarator> 

(16) <array_declarator> := <identifier> <array_size>+

(17) <array_size> := "[" <positive_int> "]"

(18) <positive_int> := <const_expr>

(19) <type_spec> := <simple_type_spec>
                    | constr_type_spec>

(20) <simple_type_spec> := <base_type_spec>
                           | <template_type_spec>
                           | <scoped_name>

(21) <base_type_spec> := <integer_type>
                         | <floating_point_type>
                         | <char_type>
                         | <byte_type>  
                         | <boolean_type>
                         | <string_type>
                         | <any_type>
                         | <type_type>

(22) <template_type> := <sequence_type>
                        | <array_type>

(23) <sequence_type> := "sequence" "<" <type_spec> ">"

(24) <array_type> := <type_spec> <array_size>+

(25) <floating_point_type> := "float"
                              | "double"

(26) <integer_type> := <signed_int>
                       | <unsinged_int>

(27) <signed_int> := "short"
                     | "long"
                     | "hyper"


(28) <unsigned_int> := "unsigned" "short"
                       | "unsigned" "long"
                       | "unsigned" "hyper"

(29) <char_type> := "char"

(30) <type_type> := "type"

(31) <string_type> := "string"

(32) <byte_type> := "byte"

(33) <any_type" := "any"

(34) <boolean_type> := "boolean"

(35) <constr_type_spec> := <struct_type>
                           | <enum_type>
                           | <union_type>

(36) <struct_type> := "struct" <identifier> [ <struct_inheritance> ] "{" <member>+ "}"

(37) <struct_inheritance> := ":" <scoped_name>
 
(38) <member> := <type_spec> <declarator> { "," <declarator> }*

(39) enum_type> := enum <identifier> "{" <enumerator> { "," <enumerator> }* "}"

(40) <enumerator> := <identifier> [ "=" <positive_int> ]
 
(41) <union_type> := "union" <identifier> "switch" "(" <switch_type_spec> ")"
                       "{" <switch_body> "}"    
  
(42) <switch_type_spec> := <integer_type>
                           | <enum_type>
                           | <scoped_name> 

(43) <switch_body> := <case>+

(44) <case> := <case_label> <element_spec> ";"

(45) <case_label> := "case" <const_expr> ":" 
                     | "default" ":";

(46) <element_spec> := <type_spec> <declarator>

(47) <exception_decl> := "exception" <identifier> [ <exception_inheritance> ] "{" <member>* "}"

(48) <exception_inheritance> := ":" <scoped_name>
 
(49) <module_decl> := "module" <identifier> "{" <definition>+ "}"

(50) <constant_decl> := "const" <const_type> <identifier> "=" <const_expr>

(51) <const_type> := <integer_type>
                     | <char_type>
                     | <boolean_type>
                     | <floating_point_type>  
                     | <string_type>
                     | <scoped_name>

(52) <const_expr> := <or_expr>

(53) <or_expr> := <xor_expr>
                  | <or_expr> "|" <xor_expr>

(54) <xor_expr> := <and_expr>
| <xor_expr> "^" <and_expr> (55) <and_expr> := <shift_expr> | <and_expr> "&" <shift_expr> (56) <shift_expr> := <add_Expr> | <shift_expr ">>" <add_expr> | <shift_expr "<<" <add_expr> (57) <add_expr> := <mult_expr> | <add_expr> "+" <mult_expr> | <add_expr> "-" <mult_expr> (58) <mult_Expr> := <unary_expr> | <mult_expr> "*" <unary_expr> | <mult_expr> "/" <unary_expr> | <mult_expr> "%" <unary_expr> (59) <unary_expr> := <unary_operator><primary_expr> | <primary_expr> (60) <unary_operator> := "-" | "+" | "~" (61) <primary_expr> := <scoped_name> | <literal> | "(" <const_expr> ")" (62) <literal> := <integer_literal> | <string_literal> | <character_literal> | <floating_point_literal> | <boolean_literal> (63) <boolean_literal> := "TRUE" | "True" | "FALSE" | "False" (64) <service_decl> := "service" <identifier> "{" <service_member>+ "}" (65) <service_member> := <property_decl> ";" | <support_decl> ";" | <export_decl> ";" | <observe_decl> ";" | <needs_decl> ";" (66) <property_decl> := <property_head> <type_spec> <declarator> { "," <declarator> }* (67) <property_head> := "[" {<property_flags> ","}* "property" "]" | "[" "property" {"," <property_flags>}* "]" (68) <property_flags> := "readonly" | "bound | "constrained" | "maybeambigious" | "maybedefault" | "maybevoid" | "optional" | "removable" | "transient" (69) <support_decl> := "interface" <declarator> { "," <declarator> }* (70) <export_decl> := "service" <declarator> { "," <declarator> }* (71) <observe_decl> := "observe" <declarator> { "," <declarator> }* (72) <needs_decl> := "needs" <declarator> { "," <declarator> }* (73) <constants_decl> := "constants" <identifier> "{" <constant_decl>+ "}" |

Basetypes

The unoidl supports the following basetypes:

any boolean byte char double float hyper long
short string type void unsigned hyper unsigned long unsigned short  

The values TRUE and FALSE (True and False) are defined for the boolean type. The type byte is a 1 byte type and represents a type which is not modified by the transport to another computer. The representation of the type char can be different on a computer which hardware/software architecture is different. It depends on the representation of the used charset. The type any is a type which can represent all possible idl types. The type type is a metatype which describes other types defined in IDL.

Comments

Comments are used to describe the source code. If the comment support a special convention, it can be used for automatically generation of documentation. The unoidl support 4 kinds of comments:

  • /* comment */

    All characters between /* and */ are ignored by the idl compiler. The characters /* are also ignored, so encapsulated comments are not allowed.

  • // comment end_of_line

    With the characters // starts a comment which ends automatic at the end of the line. All characters after // up to the end_ of_ line character are ignored.

  • /** comment */

    The characters /** shows that a special comment for automatic documentation generation begins. This kind of comment will be saved as a special documentation string by the compiler for the idl definition which follow this comment.

  • /// comment

    The characters /// shows that a special comment for automatic documentation generation begins. All characters after /// up to the end_ of_ line character are saved as a special documentation string for the next valid idl definition.

Array (not final, arrays can not be used in UNO at this time)

Arrays are not final specified in the UNO IDL and can not be used with UNO at this time!!!

Union (not final, unions can not be used in UNO at this time)

Unions are not final specified in the UNO IDL and can not be used with UNO at this time!!!


Author: Jürgen Schmidt ($Date: 2004/10/29 06:35:09 $)
Copyright 2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.


Apache Software Foundation

Copyright & License | Privacy | Website Feedback | Contact Us | Donate | Thanks

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.