Previous: Standard RPC Programs, Up: API Reference

4.5 XDR/RPC Language Compiler

This section describes the compiler's programming interface. Most of the time, its command-line interface is all is needed; it is described in grpc-compile. This section is intended for users who need more flexibility than is provided by grpc-compile.

The compiler consists of a lexer, a parser and two compiler back-ends. The lexer separates input data into valid XDR/RPC language tokens; the parser then validates the input syntax and produces an abstract syntax tree of the input. Finally, the back-ends are responsible for actually “compiling” the input into something usable by the programmer. The back-end used by the grpc-compile command is the code generation back-end. In addition, an experimental run-time compiler back-end is available, making it possible to compile dynamically definitions in the XDR/RPC language at run-time; this technology paves the way for a wide range of crazy distributed applications, the programmer's imagination being the only real limitation1.


[1] Finding useful applications leveraging the flexibility offered by the run-time compiler back-end is left as an exercise to the reader.