[NEXT] [PREV]    HANDBOOK /

Preface (1997)

Gentle
Applications
Concepts
Examples
Handbook
Support
Download

This book presents Gentle, an integrated system for compiler writers.

Gentle supports the description of compilers at a very high level and relieves users from the need to deal with implementation details. It has been used in large industrial projects and for constructing various commercial products. Users report that Gentle significantly increases productivity.

Uniform Framework and Strong Methodology

Gentle provides a uniform framework for specifying the components of a compiler.

The Gentle language was designed around a specific paradigm: recursive definition and structural induction. Input and internal data structures are defined by listing alternative ways to construct items from given constituents. Then the properties of these items are described by giving rules for the possible alternatives. These rules recursively follow the structure of items by processing their constituents. Experience has shown that this is the underlying paradigm of virtually all translation tasks.

The same concepts apply to analysis, transformation, and synthesis. They can be used to describe the backend of a compiler as a simple unparsing scheme such as sufficies for most source-to-source translations. They can also be used to specify a cost-augmented mapping to a low-level language which is used for optimal rule selection.

The rule-based approach follows the principle of locality: complex interactions are avoided and a system can be understood by understanding small pieces in isolation. Individual constructs are described independently.

The paradigm leads to a data-oriented methodology: the structure of data is mirrored by the structure of algorithms. This methodology proves to be a useful guideline in compiler projects.

Safety, Portability, Efficiency, and Openness

Gentle has been designed to enabale errors to be detected as early as possible. Although variables need not be declared, Gentle is a strongly typed language that allows the compiler to check their consistent use. Moreover, it can be ensured statically that each variable has a value when it is accessed. In cases where static rule analysis cannot prove that a program is well-behaved, this is done at run time. The violation of a language constraint is reported when it occurs, not when it has disastrous consequences. This drastically reduces debugging effort.

A specification written in Gentle can be translated automatically into highly portable C code. In many cases, the generated code is faster than hand written code.

Moreover, Gentle is an open language: compilers can be written partly in Gentle and partly in C.

Organisation of this Book

This book provides a tutorial, reference manuals, and a case study:

The Gentle Primer gives an introduction to the Gentle compiler description language. After presenting the basic concepts using simple examples (1.1 At a Glance), , these concepts are discussed in more detail in the following sections (1.2 Elements of Specifications - 1.5 Describing Syntax). Then more advanced features of Gentle are introduced (1.6 Using Types and Predicates Witten in C - 1.14 Organizing Larger Projects).

Getting Started explains how to install and use Gentle. It describes the steps required to generate a compiler from a given specification. The Language Reference Manual gives a concise specification of the Gentle compiler description language. The Reflex Reference Manual describes a simple tool that facilitates the construction of lexer specifications. The Library Reference Manual describes some utility modules that come with the Gentle system.

The Case Study discusses a compiler for a small programming language.

To get an initial impression, read Section 1.1 At a Glance and take a look at the Case Study. To start with your own first compiler, read Sections 1.2 Elements of Specifications - 1.5 Describing Syntax and refer to Getting Started.

Acknowledgments

Gentle is a descendant of Kees Koster's CDL compiler description language [7]. CDL was designed in 1969 and used in a portable COBOL-74 compiler of MPB, in the mprolog system of SzKI, and to program the Mephisto chess computer.

Gentle [10] was designed in 1989 at the GMD Karlsruhe Lab, the group that also created the Karlsruhe Ada and Modula compilers [12, 11], the BEG backend generator [3], and the Cocktail toolbox [4].

I wish to thank the following people for fruitful discussions and valuable comments: Phil Bacon, Helmut Emmelmann, Thomas Fries, Gerhard Goos, Joseph Grosch, Ulrich Grude, Stefan Jähnichen, Kees Koster, Rudolf Landwehr, Birgit Schwarz, William M. Waite, and Dwight VandenBerghe.

Friedrich Wilhelm Schröer

November 1997



[NEXT] [PREV]