|
|
This specification uses a modified Backus-Naur Form notation for describing the XDR language. This is a brief description of the notation:
For example, consider the following pattern:
a very (, very)* [cold and] rainy (day | night)
An infinite number of strings match this pattern. A few of them are:
a very rainy day a very, very rainy day a very cold and rainy day a very, very, very cold and rainy night
declaration: type-specifier identifier | type-specifier identifier [ value ] | type-specifier identifier < [ value ] > | opaque identifier [ value ] | opaque identifier < [ value ] > | string identifier < [ value ] > | type-specifier * identifier | voidvalue: constant | identifier
type-specifier: [ unsigned ] int | [ unsigned ] hyper | float | double | bool | enum-type-spec | struct-type-spec | union-type-spec | identifier
enum-type-spec: enum enum-body
enum-body: { ( identifier = value ) ( , identifier = value )* }
struct-type-spec: struct struct-body
struct-body: { ( declaration ; ) ( declaration ; )* }
union-type-spec: union union-body
union-body: switch ( declaration ) { ( case value : declaration ; ) ( case value : declaration ; )* [ default : declaration ; ] }
constant-def: const identifier = constant ;
type-def: typedef declaration ; | enum identifier enum-body ; | struct identifier struct-body ; | union identifier union-body ;
definition: type-def | constant-def
specification: definition *
bool | const | enum | int | struct | union |
case | default | float | opaque | switch | unsigned |
char | double | hyper | string | typedef | void |
int
,
unsigned int
,
bool
,
an
enum
type or any typedefed type that evaluates to one of these.
Also, the
case
values must be valid discriminant values.
Finally, a
case
value may not be specified more than once within the scope of a
union
declaration.