Copyright © 2008 Eric Niebler
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
“There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy.”
-- William Shakespeare
Proto is a framework for building Embedded Domain-Specific Languages in C++. It provides tools for constructing, type-checking, transforming and executing expression templates. More specifically, Proto provides:
Expression Templates are an advanced technique that C++ library developers use to define embedded mini-languages that target specific problem domains. The technique has been used to create efficient and easy-to-use libraries for linear algebra as well as to define C++ parser generators with a readable syntax. But developing such a library involves writing an inordinate amount of unreadable and unmaintainable template mumbo-jumbo. Boost.Proto eases the development of domain-specific embedded languages (EDSLs). Use Proto to define the primitives of your mini-language and let Proto handle the operator overloading and the construction of the expression parse tree. Immediately evaluate the expression tree by passing it a function object. Or transform the expression tree by defining the grammar of your mini-language, decorated with an assortment of tree transforms provided by Proto or defined by you. Then use the grammar to give your users short and readable syntax errors for invalid expressions! No more mumbo-jumbo -- an expression template library developed with Proto is declarative and readable.
In short, Proto is an EDSL for defining EDSLs.
This documentation makes use of the following naming and formatting conventions.
fixed width fontand is syntax-highlighted.
free_function(); that is, it is in code font and its name is followed by
()to indicate that it is a free function.
class_template<>; that is, it is in code font and its name is followed by
<>to indicate that it is a class template.
MACRO(); that is, it is uppercase in code font and its name is followed by
()to indicate that it is a function-like macro. Object-like macros appear without the trailing
In addition, notes such as this one specify non-essential information that provides additional background or rationale.
Finally, you can mentally add the following to any code fragments in this document:
// Include all of Proto #include <boost/proto/proto.hpp> // Create some namespace aliases namespace mpl = boost::mpl; namespace fusion = boost::fusion; namespace proto = boost::proto; // Allow unqualified use of Proto's wildcard pattern using proto::_;
Last revised: December 02, 2021 at 06:54:13 GMT