File: node219.html

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (424 lines) | stat: -rw-r--r-- 17,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.70)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Backus-Naur Form</TITLE>
<META NAME="description" CONTENT="Backus-Naur Form">
<META NAME="keywords" CONTENT="users_guide">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="users_guide.css">

<LINK REL="previous" HREF="node218.html">
<LINK REL="up" HREF="node217.html">
<LINK REL="next" HREF="node220.html">
</HEAD>

<BODY >

<DIV CLASS="navigation"><!--Navigation Panel-->
<A NAME="tex2html4080"
  HREF="node220.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4074"
  HREF="node217.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4070"
  HREF="node218.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4076"
  HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4078"
  HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4081"
  HREF="node220.html">Extensible Markup Language (XML)</A>
<B> Up:</B> <A NAME="tex2html4075"
  HREF="node217.html">SIDL Grammar</A>
<B> Previous:</B> <A NAME="tex2html4071"
  HREF="node218.html">Introduction</A>
 &nbsp; <B>  <A NAME="tex2html4077"
  HREF="node14.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4079"
  HREF="node317.html">Index</A></B> 
<BR>
<BR></DIV>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION05220000000000000000"></A><A NAME="s:sidl_bnf"></A><A NAME="12238"></A>
<BR>
Backus-Naur Form
</H1>
The grammar described here was extracted from the JavaCC productions defined 
in the Babel source code.  Since the comments associated with the productions 
appeared to be sufficiently descriptive, they have been retained to serve as 
the explanation of the key productions.

<P>

<BR>
<PRE  CLASS="verbatim">/*
 * The following lexical tokens are ignored.
 */
SKIP : {
   &lt; " " &gt;
 | &lt; "\n" &gt;
 | &lt; "\r" &gt;
 | &lt; "\t" &gt;
 | &lt; "//" (~["\n","\r"])* ("\n" | "\r" | "\r\n") &gt;
 | &lt; "/**/" &gt;
 | &lt; "/*" (~["*"])+ "*" ("*" | ~["*","/"] (~["*"])* "*")* "/" &gt; 
   { checkComment(image, input_stream.getBeginLine(), 
                  input_stream.getEndLine()); }
 | &lt; "[" &gt;
 | &lt; "]" &gt;
}

/*
 * The following lexical states define the transitions necessary to
 * parse documentation comments.  Documentation comments may appear
 * anywhere in the file, although they are only saved if they preceed
 * definition or method productions.  Documentation comments are
 * represented by "special tokens" in the token list.
 */
SPECIAL_TOKEN : {
   &lt; T_COMMENT : "/**" &gt; : BEGIN_DOC_COMMENT
}

&lt;BEGIN_DOC_COMMENT&gt; SKIP : {
   &lt; " " &gt;
 | &lt; "\t" &gt;
 | &lt; "*/" &gt;                   : DEFAULT
 | &lt; ("\n" | "\r" | "\r\n") &gt; : LINE_DOC_COMMENT
 | &lt; "" &gt;                     : IN_DOC_COMMENT
}

&lt;LINE_DOC_COMMENT&gt; SKIP : {
   &lt; " " &gt;
 | &lt; "\t" &gt;
 | &lt; "*/" &gt;      : DEFAULT
 | &lt; "*" (" ")?&gt; : IN_DOC_COMMENT
 | &lt; "" &gt;        : IN_DOC_COMMENT
}

&lt;IN_DOC_COMMENT&gt; SPECIAL_TOKEN : {
   &lt; "*/" &gt;                   { trimMatch(matchedToken); } : DEFAULT
 | &lt; ("\n" | "\r" | "\r\n") &gt; { trimMatch(matchedToken); } : LINE_DOC_COMMENT
}

&lt;IN_DOC_COMMENT&gt; MORE : {
   &lt; ~[] &gt;
}

/*
 * The following keywords are the lexical tokens in the SIDL grammar.
 */
TOKEN : {
   &lt; T_ABSTRACT       : "abstract" &gt;
 | &lt; T_CLASS          : "class" &gt;
 | &lt; T_COPY           : "copy" &gt;
 | &lt; T_ENUM           : "enum" &gt;
 | &lt; T_EXTENDS        : "extends" &gt;
 | &lt; T_IMPORT        : "import" &gt;
 | &lt; T_IN             : "in" &gt;
 | &lt; T_INOUT          : "inout" &gt;
 | &lt; T_FINAL          : "final" &gt;
 | &lt; T_IMPLEMENTS     : "implements" &gt;
 | &lt; T_IMPLEMENTS_ALL : "implements-all" &gt;
 | &lt; T_INTERFACE      : "interface" &gt;
 | &lt; T_LOCAL          : "local" &gt;
 | &lt; T_ONEWAY         : "oneway" &gt;
 | &lt; T_OUT            : "out" &gt;
 | &lt; T_PACKAGE        : "package" &gt;
 | &lt; T_REQUIRE        : "require" &gt;
 | &lt; T_STATIC         : "static" &gt;
 | &lt; T_THROWS         : "throws" &gt;
 | &lt; T_VERSION        : "version" &gt;
 | &lt; T_VOID           : "void" &gt;

 | &lt; T_ARRAY          : "array" &gt;
 | &lt; T_RARRAY         : "rarray" &gt;
 | &lt; T_BOOLEAN        : "bool" &gt;
 | &lt; T_CHAR           : "char" &gt;
 | &lt; T_DCOMPLEX       : "dcomplex" &gt;
 | &lt; T_DOUBLE         : "double" &gt;
 | &lt; T_FCOMPLEX       : "fcomplex" &gt;
 | &lt; T_FLOAT          : "float" &gt;
 | &lt; T_INT            : "int" &gt;
 | &lt; T_LONG           : "long" &gt;
 | &lt; T_OPAQUE         : "opaque" &gt;
 | &lt; T_STRING         : "string" &gt;

 | &lt; T_IDENTIFIER     : &lt;T_LETTER&gt; (&lt;T_LETTER&gt; | &lt;T_DIGIT&gt; | "_")* &gt;
 | &lt; T_VERSION_STRING : &lt;T_INTEGER&gt; ("." &lt;T_INTEGER&gt;)+ &gt;
 | &lt; T_INTEGER        : (["-","+"])? (&lt;T_DIGIT&gt;)+ &gt;
 | &lt; T_DIGIT          : ["0"-"9"] &gt;
 | &lt; T_LETTER         : ["a"-"z","A"-"Z"] &gt;

 | &lt; T_CLOSE_ANGLE    : "&gt;" &gt;
 | &lt; T_CLOSE_CURLY    : "}" &gt;
 | &lt; T_CLOSE_PAREN    : ")" &gt;
 | &lt; T_COMMA          : "," &gt;
 | &lt; T_EQUALS         : "=" &gt;
 | &lt; T_OPEN_ANGLE     : "&lt;" &gt;
 | &lt; T_OPEN_CURLY     : "{" &gt;
 | &lt; T_OPEN_PAREN     : "(" &gt;
 | &lt; T_SEMICOLON      : ";" &gt;
 | &lt; T_SCOPE          : "." &gt;

 | &lt; T_COLUMN_MAJOR   : "column-major" &gt;
 | &lt; T_ROW_MAJOR      : "row-major" &gt;

 | &lt; T_CATCH_ALL      : ~[] &gt;
}

/**
 * A SIDL Specification contains zero or more version productions followed
 * by zero or more import productions followed by zero or more package
 * productions followed by the end-of-file.  Before leaving the specification
 * scope, resolve all references in the symbol table.
 */
Specification ::= ( Require )* ( Import )* ( Package )* &lt;EOF&gt;

/**
 * A SIDL Require production begins with a "require" token and is followed
 * by a scoped identifer, a "version" token, and a version number.  The
 * scoped identifier must be not defined.  The version number is specified
 * in the general form "V1.V2...Vn" where Vi is a non-negative integer.
 */
Require ::=
  &lt;T_REQUIRE&gt; ScopedIdentifier
  &lt;T_VERSION&gt; ( &lt;T_INTEGER&gt; | &lt;T_VERSION_STRING&gt; ) &lt;T_SEMICOLON&gt;

/**
 * A SIDL Import production begins with an "import" token and is followed
 * by a scoped identifier which is optionally followed by a "version" token
 * and a version number.  The scoped identifier must be defined and it must
 * be a package.  The version number is specified in the general form
 * "V1.V2...Vn" where Vi is a non-negative integer.  A particular package
 * may only be included in one import statement.  The import package name
 * is added to the default search path.  At the end of the parse, any import
 * statements that were not used to resolve a symbol name are output as
 * warnings.
 */
Import ::=
  &lt;T_IMPORT&gt; ScopedIdentifier
  [ &lt;T_VERSION&gt; ( &lt;T_INTEGER&gt; | &lt;T_VERSION_STRING&gt;) ] &lt;T_SEMICOLON&gt;

/**
 * The SIDL package specification begins with a "package" token followed by
 * a scoped identifier.  The new package namespace begins with an open curly
 * brace, a set of zero or more definitions, and a close curly brace.  The
 * closing curly brace may be followed by an optional semicolon.  The package
 * identifier must have a version defined for it, and it must not have been
 * previously defined as a symbol or used as a forward reference.  The parent
 * of the package must itself be a package and must have been defined.  The
 * symbols within the curly braces will be defined within the package scope.
 */
Package ::=
  [ &lt;T_FINAL&gt; ] &lt;T_PACKAGE&gt; ScopedIdentifier
  [ &lt;T_VERSION&gt; ( &lt;T_INTEGER&gt; | &lt;T_VERSION_STRING&gt; ) ]
  &lt;T_OPEN_CURLY&gt; ( Definition )* &lt;T_CLOSE_CURLY&gt; [ &lt;T_SEMICOLON&gt; ]

/**
 * A SIDL Definition production consists of a class, interface, enumerated
 * type, or package.
 */
Definition ::= ( Class | Enum | Interface | Package )

/**
 * A SIDL class specification begins with an optional abstract keyword
 * followed by the class token followed by an identifier.  The abstract
 * keyword is required if and only if there are abstract methods in the
 * class.  The class keyword is followed by an identifer.  The identifier
 * string may not have been previously defined, although it may have been
 * used as a forward reference.  The identifier string may be preceeded
 * by a documentation comment.  A class may optionally extend another class;
 * if no class is specified, then the class will automatically extend the
 * SIDL base class (unless it is itself the SIDL base class).  Then parse
 * the implements-all and implements clauses.  The interfaces parsed during
 * implements-all are saved in a set and then all those methods are defined
 * at the end of the class definition.  The methods block begins with an
 * open curly-brace followed by zero or more methods followed by a close
 * curly-brace and optional semicolon.
 */
Class ::=
  [ &lt;T_ABSTRACT&gt; ] &lt;T_CLASS&gt; Identifier
  [ &lt;T_EXTENDS&gt; ScopedIdentifier ]
  [ &lt;T_IMPLEMENTS_ALL&gt; AddInterface ( &lt;T_COMMA&gt; AddInterface )* ]
  [ &lt;T_IMPLEMENTS&gt; AddInterface ( &lt;T_COMMA&gt; AddInterface )* ]
  &lt;T_OPEN_CURLY&gt; ( ClassMethod )* &lt;T_CLOSE_CURLY&gt; [ &lt;T_SEMICOLON&gt; ]

/**
 * The SIDL enumeration specification begins with an "enum" token followed by
 * an identifier.  The enumerator list begins with an open curly brace, a set
 * of one or more definitions, and a close curly brace.  The closing curly
 * brace may be followed by an optional semicolon.  The enumeration symbol
 * identifier must have a version defined for it, and it must not have been
 * previously defined as a symbol.  Forward references are not allowed for
 * enumerated types.  This routine creates the enumerated class and then
 * grabs the list of enumeration symbols and their optional values.
 */
Enum ::=
  &lt;T_ENUM&gt; Identifier &lt;T_OPEN_CURLY&gt; Enumerator ( &lt;T_COMMA&gt; Enumerator )*
  &lt;T_CLOSE_CURLY&gt; [ &lt;T_SEMICOLON&gt; ]

/**
 * The SIDL enumerator specification consists of an identifier followed
 * by an optional assignment statement beginning with an equals and followed
 * by an integer value.  This routine adds the new enumeration symbol to
 * the list and then returns.
 */
Enumerator ::= Identifier [ &lt;T_EQUALS&gt; &lt;T_INTEGER&gt; ]

/**
 * A SIDL interface specification begins with the interface token followed
 * by an identifier.  An interface may have an extends block consisting of
 * a comma-separated sequence of interfaces.  The methods block begins with
 * an open curly-brace followed by zero or more methods followed by a close
 * curly-brace and optional semicolon.  Interfaces may be preceeded by a
 * documentation comment.  The identifier string may not have been previously
 * defined, although it may have been used as a forward reference.  If the
 * interface does not extend another interface, then it must extend the base
 * SIDL interface (unless, of course, this is the definition for the base
 * SIDL interface).
 */
Interface ::=
  &lt;T_INTERFACE&gt; Identifier [ &lt;T_EXTENDS&gt; AddInterface
  ( &lt;T_COMMA&gt; AddInterface )* ]
  &lt;T_OPEN_CURLY&gt; ( InterfaceMethod )* &lt;T_CLOSE_CURLY&gt; [ &lt;T_SEMICOLON&gt; ]

/**
 * This production parses the next scoped identifier and validates that
 * the name exists and is an interface symbol.  Then each of its methods
 * are checked for validity with the existing methods.  If everything
 * checks out, then the new interface is added to the existing object.
 */
AddInterface ::= ScopedIdentifier

/**
 * This production parses the SIDL method description for a class method.
 * A class method may start with abstract, final, or static.  An error is
 * thrown if the method has already been defined in the class object or if
 * the method name is the same as the class name.  An error is also thrown
 * if a method has been defined in a parent class and (1) the signatures
 * do not match, (2) either of the methods is static, (3) the existing method
 * is final, or (4) the new method is abstract but the existing method was
 * not abstract.
 */
ClassMethod ::= [ ( &lt;T_ABSTRACT&gt; | &lt;T_FINAL&gt; | &lt;T_STATIC&gt; ) ] Method

/**
 * This method parses a SIDL method and then checks whether it can be
 * added to the interface object.  An error is thrown if the method has
 * already been added to the interface object or if the method name is
 * the same as the interface name.  An error is also thrown if a previous
 * method was defined with the same name but a different signature.
 */
InterfaceMethod ::= Method

/**
 * The SIDL method production has a return type, a method identifier,
 * an optional argument list, an optional communication modifier, and
 * an optional throws clause.  The return type may be void (no return
 * type) or any valid SIDL type.  The method is built piece by piece.
 */
Method ::=
  ( &lt;T_VOID&gt; | [ &lt;T_COPY&gt; ] Type() ) Identifier [ &lt;T_IDENTIFIER&gt; ]
  &lt;T_OPEN_PAREN&gt; [ Argument ( &lt;T_COMMA&gt; Argument )* ] &lt;T_CLOSE_PAREN&gt;
  [ &lt;T_LOCAL&gt; | &lt;T_ONEWAY&gt; ] [ &lt;T_THROWS&gt; ScopedIdentifier
  ( &lt;T_COMMA&gt; ScopedIdentifier )* ] &lt;T_SEMICOLON&gt;

/**
 * Parse a SIDL argument.  Arguments begin with an optional copy modifier
 * followed by in, out, or inout followed by a type and a formal argument.
 * The argument is returned on the top of the argument stack.  This routine
 * also checks that the copy modifier is used only for symbol objects.  For
 * all other types, copy is redundant.
 */
Argument ::= [ &lt;T_COPY&gt; ] ( &lt;T_IN&gt; | &lt;T_OUT&gt; | &lt;T_INOUT&gt; ) 
	 (Type Identifier | Rarray)

/**
 * A SIDL type consists of one of the standard built-in types (boolean,
 * char, dcomplex, double, fcomplex, float, int, long, opaque, and string),
 * a user-defined type (interface, class, or enum), or an array.  This
 * production parses the type and pushes the resulting type object on
 * the top of the argument stack.
 */
Type ::=
  ( &lt;T_BOOLEAN&gt;
  | &lt;T_CHAR&gt;
  | &lt;T_DCOMPLEX&gt;
  | &lt;T_DOUBLE&gt;
  | &lt;T_FCOMPLEX&gt;
  | &lt;T_FLOAT&gt;
  | &lt;T_INT&gt;
  | &lt;T_LONG&gt;
  | &lt;T_OPAQUE&gt;
  | &lt;T_STRING&gt;
  | Array
  | SymbolType )

/** 
 * Parse an array construct and push the resulting type and ordering
 * on top of the stack.  Only dimensions one through MAX_ARRAY_DIM
 * (inclusive) are supported.
 */
Array ::=
  &lt;T_ARRAY&gt; &lt;T_OPEN_ANGLE&gt; Type [ &lt;T_COMMA&gt; ( &lt;T_INTEGER&gt;
  [ &lt;T_COMMA&gt; ( &lt;T_COLUMN_MAJOR&gt; | &lt;T_ROW_MAJOR&gt; ) ]
  | ( &lt;T_COLUMN_MAJOR&gt;| &lt;T_ROW_MAJOR&gt; ) ) ] &lt;T_CLOSE_ANGLE&gt;

/** 
 * Parse an rarray construct and push the resulting type and ordering
 * on top of the stack.  Only dimensions one through MAX_ARRAY_DIM
 * (inclusive) are supported.  And don't forget the indicies!
 */
Rarray ::= &lt;T_RARRAY&gt; &lt;T_OPEN_ANGLE&gt; Type [ &lt;T_COMMA&gt; &lt;T_INTEGER&gt; ]
       &lt;T_CLOSE_ANGLE&gt; Identifier
       &lt;T_OPEN_PAREN&gt; Identifier ( &lt;T_COMMA Identifier )*
       &lt;T_CLOSE_PAREN&gt;

/**
 * This production parses a scoped identifier and verifies that it is
 * either a forward reference or a symbol that may be used as a type
 * (either an enum, an interface, or a class).
 */
SymbolType ::= ScopedIdentifier

/**
 * All SIDL scoped names are of the general form "ID ( . ID )*".  Each
 * identifier ID is a string of letters, numbers, and underscores that
 * must begin with a letter.  The scope resolution operator "." separates
 * the identifiers in a name.
 */
ScopedIdentifier ::= Identifier ( &lt;T_SCOPE&gt; Identifier )*

/**
 * A SIDL identifier must start with a letter and may be followed by any
 * number of letters, numbers, or underscores.  It may not be a reserved
 * word in any of the SIDL implementation languages (e.g., C or C++).
 */
Identifier ::= &lt;T_IDENTIFIER&gt;
</PRE></td></tr></table></blockquote>
<P>

<P>
<BR><HR>
<ADDRESS>
<br><br>babel-0.10.2<br>users_guide Last Modified 2005-03-23<br><br><a href="http://www.llnl.gov/CASC/components">http://www.llnl.gov/CASC/components</a><br><a href="mailto:components@llnl.gov">components@llnl.gov</a>
</ADDRESS>
</BODY>
</HTML>