[NEXT] [PREV]    HANDBOOK / GENTLE PRIMER /

At a Glance

Gentle
Applications
Concepts
Examples
Handbook
Support
Download

This section gives some simple but complete examples of Gentle specifications. The intend is not to discuss details, but to provide the reader with a feeling for the general framework. Subsequent sections will describe the specific concepts and conventions.

We start with a simple parser for arithmetic expressions, which we will then extend to a calculator. While the calculator is written along the concrete syntax of expressions, a compiler is often based on abstract syntax. We show how abstract syntax can be defined in Gentle, and how a concrete source text can be mapped onto a corresponding abstract representation. Two examples then show how to process abstract syntax: a refined version of the calculator, and a program that computes the derivative of an expression. We conclude with a simple code generator.





[NEXT] [PREV]