RPCL formal language definition

# RPCL Language Definition

There follows a Backus&hyphen.Naur Form (BNF) definition of the RPC language, RPCL Version 3.0. This is a reference definition and should be used to solve any ambiguity or error that could arise when writing in RPCL. Reserved keywords are in upper case. Words inside angle brackets are productions: that is, they may be replaced by the part on the right of the '::=' of their own definition. The sign '|' means 'exclusive or', that is one form or the other may be used.

    <rpcl_program>	::=     PACKAGE <ident> IS
                                     { <type_dec> ; }*
                                     { <other_dec> ; }*
                            END <ident> ;

    <type_dec>      ::=     TYPE <ident> IS <type>

    		|	<pragma>

    <other_dec>     ::=     PROCEDURE <ident> <formal_params>

                    |       FUNCTION <ident> <formal_params>  RETURN <simple_type>

                    |       <pragma>

    <formal_params>	::=     ( <formal_def> { ; <formal_def> }* )

                    |       <void>

    <formal_def>	::=     <identlist> : <direction> <type>

    <direction>     ::=     IN
                    |       OUT
                    |       IN OUT

    <pragma>        |       PRAGMA EXTERNAL_MARSHALLING( <identlist> );

    	        |       PRAGMA CONCURRENT ( <identlist> )
                    |       PRAGMA CAST ( <identlist> )
                    |       PRAGMA TIMEOUT ( <ident> , <number> )
                    |       PRAGMA CALL_STATUS ( <ident> , <ident> )

    <identlist>     ::=     <ident> {, <ident>}*

    <type>          ::=     <simple_type>
                     |      <structured_type>
            	 |	ACCESS <subtype>

    <subtype>       ::=     <ident>
                     |      <simple type>

    <simple_type>	::=     RPC_CHAR
                     |      RPC_BYTE
                     |      RPC_SHORT
                     |      RPC_INTEGER
                     |      RPC_LONG
                     |      RPC_REAL32
                     |      RPC_REAL48
                     |      RPC_REAL64
                     |      RPC_REAL128

    <structured_type>::=    ARRAY  (range  { ,  <range>  }*)  OF <subtype>
    		 |      RECORD { <identlist> : <subtype> }* END RECORD
                     |      SEQUENCE (index) OF <subtype>
                     |      STRING ( [index] )
                     |      SUBSTRING ( [index] )

     <range>         ::=    [index] ..  [index]

     <number>        ::=    < A number in 1 ..  65536>

     <ident>         ::=     < A Pascal&hyphen.like identifier>

Where

    	         ::=     means "may be composed of"
                     |       means "or"
                     { }*    means zero or more times;
    		 <void>  means no characters at all

## Notes

- Comments in RPCL start with two dashes '--' and end at the end of the line. Comments can be put anywhere except inside keywords or identifiers.
- STRING is not equivalent to a type SEQUENCE OF RPC_CHAR, because a special (more efficient) Courier message format is used to represent objects of type STRING and SUBSTRING.
- The maximum length of identifier is limited to 25 characters.
- RPCL is case independent, meaning that you can write your desciption file in any mixture of upper and lower case. The identifiers 'VAR_ONE' and 'var_one' are, for example, the same, as are the keywords "String" and "STRING".
- Identifiers may not be reserved words in any language in which stubs are to be generated. In order to avoid clashes within the stubs, one should also avoid identifiers starting with any of:

     abort_  call_   m_      reject_         return_         rpc_

- Similarly, one should avoid the identifiers:

            b               header                  procedure_number
            program_number  version_number          which
            why

- The package should not have the same name as any of the procedures within it.