ONC+ Developer's Guide

Lexical Notes

  1. Comments begin with /* and end with */.

  2. White space serves to separate items and is otherwise ignored.

  3. An identifier is a letter followed by an optional sequence of letters, digits, or underbars (_). The case of identifiers is not ignored.

  4. A constant is a sequence of one or more decimal digits, optionally preceded by a minus-sign (-).


    Example C-1 XDR Specification

    Syntax Information
    declaration:
    	type-specifier identifier
    	| type-specifier identifier "[" value "]"
    	| type-specifier identifier "<" [ value ] ">"
    	| "opaque" identifier "[" value "]"
    	| "opaque" identifier "<" [ value ] ">"
    	| "string" identifier "<" [ value ] ">"
    	| type-specifier "*" identifier
    	| "void"
    
    value:
    	constant
    	| identifier
    
    type-specifier:
    	 [ "unsigned" ] "int"
    	| [ "unsigned" ] "hyper"
    	| "float"
    	| "double"
    	| "quadruple"
    	| "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 *