Previous Up

9.2  Serialized representation of EXDR terms

The following is the specification of what is actually send over the communication channels. This is all the information needed to create new language mappings for EXDR terms. This definition corresponds to EXDR_VERSION 2:

ExdrTerm      ::=   'V' Version CompactFlag? Term
CompactFlag   ::=   'C'
Term          ::=   (Integer|Double|String|List|Nil|Struct|Variable)
Integer       ::=   ('B' <byte> | 'I' XDR_int | 'J' XDR_long)
Double        ::=   'D' XDR_double
String        ::=   ('S' Length <byte>* | 'R' Index)
List          ::=   '[' Term (List|Nil)
Nil           ::=   ']'
Struct        ::=   'F' Arity String Term*
Variable      ::=   '_'
Length        ::=   XDR_nat
Index         ::=   XDR_nat
Arity         ::=   XDR_nat
Version       ::=   <byte>
XDR_int       ::=   <4 bytes, msb first>
XDR_long      ::=   <8 bytes, msb first>
XDR_double    ::=   <8 bytes, ieee double, exponent first>
XDR_nat       ::=   ( <8 bits: 1 + seven bits unsigned value>
                    | XDR_int )                    // >= 0

The version byte is 1 or 2. EXDR version 1 encodings are also valid version 2 encodings, and version version 2 decoders can read version 1 encoded terms.

XDR_long, XDR_int and byte are all signed integers in two’s complement representation.

The string reference code R means that the string is the same as the Index’th S-encoded string that occurred in the EXDR term earlier. The presence of the CompactFlag C in the header indicates that the term may actually contain such string references. If the flag is absent, the term does not contain any.


Previous Up