Boost C++ Libraries Home Libraries People FAQ More

Next

Chapter 1. Phoenix 3.2.0

Joel de Guzman

Dan Marsden

Thomas Heller

John Fletcher

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Table of Contents

Release Notes
What's New
Phoenix - warning on lambda and let
Phoenix 3.2.0 (Boost 1.58.0)
Phoenix 3.1.1
Phoenix 3.1.0
Phoenix 3.0.6 (Boost 1.57.0)
Phoenix 3.0.5
Phoenix 3.0
Introduction
Starter Kit
Values
References
Arguments
Lazy Operators
Lazy Statements
Construct, New, Delete, Casts
Lazy Functions
More
Basics
Organization
Actor
Modules
Core
Values
References
Arguments
Nothing
Function
Adapting Functions
Operator
Statement
Block Statement
if_ Statement
if_else_ Statement
switch_ Statement
while_ Statement
do_while_ Statement
for_ Statement
try_ catch_ Statement
throw_
Object
Construction
New
Delete
Casts
Scope
Local Variables
let
lambda
Bind
Binding Function Objects
Binding Functions
Binding Member Functions
Binding Member Variables
Compatibility with Boost.Bind
STL
Container
Algorithm
Tuple
Inside Phoenix
Actors in Detail
Phoenix Expressions
Boilerplate Macros
More on Actions
Predefined Expressions and Rules
Custom Terminals
Placeholder Unification
Advanced Examples
Extending Actors
Adding an expression
Transforming the Expression Tree
Lazy List
Background
What is provided
Tutorial with examples
Arithmetic functions
List Generation
Exceptions
Implementation Details
Testing
Where Next?
Maintenance
Background
My Understanding of how maintenance works
Method in use
Experience
Maintenance Tools
Bugs to be fixed
Compilers
Wrap Up
Acknowledgments
References

Preface

Functional programming is so called because a program consists entirely of functions. The main program itself is written as a function which receives the program's input as its argument and delivers the program's output as its result. Typically the main function is defined in terms of other functions, which in turn are defined in terms of still more functions until at the bottom level the functions are language primitives.

John Hughes-- Why Functional Programming Matters

Description

Phoenix enables Functional Programming (FP) in C++. The design and implementation of Phoenix is highly influenced by FC++ by Yannis Smaragdakis and Brian McNamara and the BLL (Boost Lambda Library) by Jaakko Jaarvi and Gary Powell. Phoenix is a blend of FC++ and BLL using the implementation techniques used in the Spirit inline parser.

Phoenix is a header only library. It is extremely modular by design. One can extract and use only a small subset of the full library, literally tearing the library into small pieces, without fear that the pieces won't work anymore. The library is organized in highly independent modules and layers.

How to use this manual

The Phoenix library is organized in logical modules. This documentation provides a user's guide and reference for each module in the library. A simple and clear code example is worth a hundred lines of documentation; therefore, the user's guide is presented with abundant examples annotated and explained in step-wise manner. The user's guide is based on examples: lots of them.

As much as possible, forward information (i.e. citing a specific piece of information that has not yet been discussed) is avoided in the user's manual portion of each module. In many cases, though, it is unavoidable that advanced but related topics be interspersed with the normal flow of discussion. To alleviate this problem, topics categorized as "advanced" may be skipped at first reading.

Some icons are used to mark certain topics indicative of their relevance. These icons precede some text to indicate:

Table 1.1. Icons

Icon

Name

Meaning

Note

Information provided is auxiliary but will give the reader a deeper insight into a specific topic. May be skipped.

Alert

Information provided is of utmost importance.

Tip

A potentially useful and helpful piece of information.


Unless otherwise noted using namespace boost::phoenix; is assumed

...To Joel's dear daughter, Phoenix


Next