grammar.idl revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26/*
27 *    COMPONENT_NAME:  idl.parser
28 *
29 *    ORIGINS: 27
30 *
31 *    5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
32 *
33 */
34
35CORBA 2.3 IDL
36---------------
37
38(1) <specification>	<definition><specification'>
39
40(1) <specification'>	e
41			<definition><specification'>
42
43(2) <definition>	<type_dcl> ";"
44			<const_dcl> ";"
45			<except_dcl> ";"
46			<interface> ";"
47			<module> ";"
48			<value> ";"
49
50(3) <module>		"module" <id> "{" <module'> "}"
51
52(3) <module'>		<definition><module''>
53
54(3) <module''>		<definition><module''>
55                        e
56
57(4) <interface>		<interface_dcl>
58			<forward_dcl>
59
60(5) <interface_dcl>	<interface_header> "{" <interface_body> "}"
61
62(6) <forward_dcl>	"abstract" "interface" <id>
63			"interface" <id>
64
65(7) <interface_header>	"abstract" "interface" <id> <interface_header'>
66			"interface" <id> <interface_header'>
67
68(7) <interface_header'>	e
69			<interface_inheritance_spec>
70
71(8) <interface_body>	<export><interface_body'>
72
73(8) <interface_body'>	e
74			<export><interface_body'>
75
76(9) <export>		<type_dcl> ";"
77			<const_dcl> ";"
78			<except_dcl> ";"
79			<attr_dcl> ";"
80			<op_dcl> ";"
81
82
83
84(10) <interface_inheritance_spec>	":" <scoped_name> <inheritance_spec'>
85
86(10) <interface_inheritance_spec'>	e
87			"," <scoped_name> <inheritance_spec'>
88
89(12) <scoped_name>	<id> <scoped_name'>
90			"::" <id> <scoped_name'>
91
92(12) <scoped_name'>	e
93			"::" <id> <scoped_name'>
94
95(13) <value>		<value_dcl>
96			<value_abs_dcl>
97			<value_box_dcl>
98			<value_forward_dcl>
99
100(14) <value_forward_dcl>    "abstract" "valuetype" <id>
101			"valuetype" <id>
102
103(15) <value_box_dcl>	"valuetype" <id> <type_spec>
104
105(16) <value_abs_dcl>	"abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
106			"abstract" "valuetype" <id> "{" <export> <vad> "}"
107
108(16) <vad>		e
109			<export> <vad>
110
111(17) <value_dcl>	<value_header> "{" <value_element> <ve> "}"
112
113(17) <ve>		e
114			<value_element> <ve>
115
116(18) <value_header>	"custom" "valuetype" <id> <value_inheritance_spec>
117			"valuetype" <id> <value_inheritance_spec>
118			"custom" "valuetype" <id>
119			"valuetype" <id>
120
121(19) <value_inheritance_spec>	<opt_inherits> <opt_supports>
122
123(19) <opt_inherits>	e
124			":" "truncatable" <value_name> <value_name_list>
125			":" <value_name> <value_name_list>
126
127(19) <value_name_list>	e
128			"," <value_name> <value_name_list>
129
130(19) <opt_supports>	e
131			"supports" <interface_name> <interface_name_list>
132
133(19) <interface_name_list>  e
134			"," <interface_name> <interface_name_list>
135
136(20) <value_name>	<scoped_name>
137
138(21) <value_element>	<export>
139			<state_member>
140			<init_dcl>
141
142(22) <state_member>	"public" <type_spec> <declarators> ";"
143			"private" <type_spec> <declarators> ";"
144
145(23) <init_dcl>		"factory" <id> "(" ")"
146			"factory" <id> "(" <init_param_dcls> ")"
147
148(24) <init_param_dcls>	<init_param_decl>
149			<init_param_decl> "," <init_param_dcls>
150
151(25) <init_param_dcl>	<init_param_attribute> <param_type_spec> <simple_declarator>
152
153(26) <init_param_attribute> "in"
154
155(27) <const_dcl>	"const" <const_type> <id> "=" <const_exp>
156
157(28) <const_type>	<integer_type>
158			<char_type>
159			<wide_char_type>
160			<boolean_type>
161			<floating_pt_type>
162			<string_type>
163			<wide_string_type>
164			<scoped_name>
165			<octet_type>
166
167(29) <const_exp>	<or_expr>
168
169(30) <or_expr>		<xor_expr> <or_expr'>
170
171(30) <or_expr'>		e
172			"|" <xor_expr> <or_expr'>
173
174(31) <xor_expr>		<and_expr> <xor_expr'>
175
176(31) <xor_expr'>	e
177			"^" <and_expr> <xor_expr'>
178
179(32) <and_expr>		<shift_expr><and_expr'>
180
181(32) <and_expr'>	e
182			"&" <shift_expr> <and_expr'>
183
184(33) <shift_expr>	<add_expr> <shift_expr'>
185
186(33) <shift_expr'>	e
187			">>" <add_expr> <shift_expr'>
188			"<<" <add_expr> <shift_expr'>
189
190(34) <add_expr>		<mult_expr> <add_expr'>
191
192(34) <add_expr'>	e
193			"+" <mult_expr> <add_expr'>
194			"-" <mult_expr> <add_expr'>
195
196(35) <mult_expr>	<unary_expr> <mult_expr'>
197
198(35) <mult_expr'>	e
199			"*" <unary_expr> <mult_expr'>
200			"/" <unary_expr> <mult_expr'>
201			"%" <unary_expr> <mult_expr'>
202
203(36) <unary_expr>	<unary_operator> <primary_expr>
204			<primary_expr>
205
206(37) <unary_operator>	"-"
207			"+"
208			"~"
209
210(38) <primary_expr>	<scoped_name>
211			<literal>
212			"(" <const_exp> ")"
213
214(39) <literal>		<<integer_literal>>
215			<<string_literal>>>
216			<<wide_string_literal>>>
217			<<character_literal>>
218			<<wide_character_literal>>
219			<<fixed_pt_literal>>
220			<<floating_pt_literal>>
221			<<boolean_literal>>
222
223(40) <boolean_literal>	"TRUE"
224			"FALSE"
225
226(41) <positive_int_const>   <const_exp>
227
228(42) <type_dcl>		"typedef" <type_declarator>
229			<struct_type>
230			<union_type>
231			<enum_type>
232			"native" <simple_declarator>
233
234(43) <type_declarator>	<type_spec> <declarators>
235
236(44) <type_spec>	<simple_type_spec>
237			<constr_type_spec>
238
239(45) <simple_type_spec>	<base_type_spec>
240			<template_type_spec>
241			<scoped_name>
242
243(46) <base_type_spec>	<floating_pt_type>
244			<integer_type>
245			<char_type>
246			<wide_char_type>
247			<boolean_type>
248			<octet_type>
249			<any_type>
250			<object_type>
251			<value_base_type>
252
253(47) <template_type_spec> <sequence_type>
254			<string_type>
255			<wide_string_type>
256			<fixed_pt_type>
257
258(48) <constr_type_spec>	<struct_type>
259			<union_type>
260			<enum_type>
261
262(49) <declarators>	<declarator> <declarators'>
263
264(49) <declarators'>	e
265			"," <declarator> <declarators'>
266
267(50) <declarator>	<simple_declarator>
268			<complex_declarator>
269
270(51) <simple_declarator> <id>
271
272(52) <complex_declarator>   <array_declarator>
273
274(53) <floating_pt_type>	"float"
275			"double"
276			"long" "double"
277
278(54) <integer_type>	<signed_int>
279			<unsigned_int>
280
281(55) <signed_int>	"long"
282			"short"
283			"long" "long"
284
285// 56-58 omitted
286
287(59) <unsigned_int>	"unsigned" <signed_int>
288
289// 60-62 omitted
290
291(63) <char_type>	"char"
292
293(64) <wide_char_type>	"wchar"
294
295(65) <boolean_type>	"boolean"
296
297(66) <octet_type>	"octet"
298
299(67) <any_type>		"any"
300
301(68) <object_type>	"Object"
302
303(69) <struct_type>	"struct" <id> "{" <member_list> "}"
304
305(70) <member_list>	<member> <member_list'>
306
307(70) <member_list'>	e
308			<member> <member_list'>
309
310(71) <member>		<type_spec> <declarators> ";"
311
312(72) <union_type>	"union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"
313
314(73) <switch_type_spec>	<integer_type>
315			<char_type>
316			<boolean_type>
317			<enum_type>
318			<scoped_name>
319
320(74) <switch_body>	<case> <switch_body'>
321
322(74) <switch_body'>	e
323			<case> <switch_body'>
324
325(75) <case>		<case_label> <case'> <element_spec> ";"
326
327(75) <case'>		e
328			<case_label> <case'>
329
330(76) <case_label>	"case" <const_exp> ":"
331			"default" ":"
332
333(77) <element_spec>	<type_spec> <declarator>
334
335(78) <enum_type>	"enum" <id> "{" <id> <enum_type'> "}"
336
337(78) <enum_type'>	e
338			"," <id> <enum_type'>
339
340// 79 omitted
341
342(80) <sequence_type>	"sequence" "<" <simple_type_spec> <sequence_type'>
343
344(80) <sequence_type'>	"," <positive_int_const> ">"
345			">"
346
347(81) <string_type>	"string"
348			"string" "<" <positive_int_const> ">"
349
350(82) <wide_string_type>	"wstring"
351			"wstring" "<" <positive_int_const> ">"
352
353(83) <array_declarator>	<id> <fixed_array_size>
354
355(84) <fixed_array_size>	"[" <positive_int_const> "]"
356
357(85) <attr_dcl>		"readonly" "attribute" <param_type_spec> <id> <attr_dcl'>
358			"attribute" <param_type_spec> <id> <attr_dcl'>
359
360(85) <attr_dcl'>	e
361			"," <id> <attr_dcl'>
362
363(86) <except_dcl>	"exception" <id> "{" <except_dcl'> "}"
364
365(86) <except_dcl'>	e
366			<member> <except_dcl'>
367
368(87) <op_dcl>		<op_attribute> <op_type_spec> <op_dcl'>
369			<op_type_spec> <op_dcl'>
370
371(87) <op_dcl'>		<id> <parameter_dcls> <op_dcl''>
372			<macroID> <parameter_dcls'> <op_dcl''>
373
374(87) <op_dcl''>		e
375			<context_expr>
376			<raises_expr>
377			<raises_expr> <context_expr>
378
379(88) <op_attribute>	"oneway"
380
381(89) <op_type_spec>	<param_type_spec>
382			"void"
383
384(90) <parameter_dcls>	"(" <parameter_dcls'>
385
386(90) <parameter_dcls'>	<param_dcl> <parameter_dcls''> ")"
387			")"
388
389(90) <parameter_dcls''>	e
390			"," <param_dcl> <parameter_dcls''>
391
392(91) <param_dcl>	<param_attribute> <param_type_spec> <id>
393
394(92) <param_attribute>	"in"
395			"out"
396			"inout"
397
398(93) <raises_expr>	"raises" "(" <scoped_name> <raises_expr'> ")"
399
400(93) <raises_expr'>	e
401			"," <scoped_name> <raises_expr'>
402
403(94) <context_expr>	"context" "(" <string_literal> <context_expr'> ")"
404
405(94) <context_expr'>        e
406			"," <string_literal> <context_expr'>
407
408(95) <param_type_spec>	<base_type_spec>
409			<string_type>
410			<wide_string_type>
411			<scoped_name>
412
413(96) <fixed_pt_type>	"fixed" "<" <positive_int_const> "," <positive_int_const> ">"
414
415(97) <fixed_pt_const_type> "fixed"
416
417(98) <value_base_type>	"ValueBase"
418
419NOTES:
420
421- #define id(id, id, ...) token-string is a macro definition.  There can be no space between the first id and the left paren.  Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.
422
423