4 [authors [Niebler, Eric]]
5 [copyright 2008 Eric Niebler]
10 Generic expression template, grammar and
11 tree-transformation framework.
14 Distributed under the Boost Software License, Version 1.0.
15 (See accompanying file LICENSE_1_0.txt or copy at
16 [@http://www.boost.org/LICENSE_1_0.txt])
21 / Copyright (c) 2008 Eric Niebler
23 / Distributed under the Boost Software License, Version 1.0. (See accompanying
24 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
27 [/ QuickBook Document version 1.3 ]
31 [def __note__ [$images/note.png]]
32 [def __alert__ [$images/caution.png]]
33 [def __detail__ [$images/note.png]]
34 [def __tip__ [$images/tip.png]]
39 [@http://acts.nersc.gov/formertools/pete/index.html PETE]]
41 [@http://spirit.sourceforge.net Spirit Parser Framework]]
43 [@http://spirit.sourceforge.net Spirit]]
45 [@../../libs/xpressive/index.html Boost.Xpressive]]
47 [@../../libs/typeof/index.html Boost.Typeof]]
49 [classref boost::proto::expr `proto::expr<>`]]
51 [classref boost::proto::basic_expr `proto::basic_expr<>`]]
53 [funcref boost::proto::deep_copy `proto::deep_copy()`]]
55 [classref boost::proto::domain `proto::domain<>`]]
57 [classref boost::proto::default_domain `proto::default_domain`]]
59 [classref boost::proto::extends `proto::extends<>`]]
60 [def _external_transform_
61 [classref boost::proto::external_transform `proto::external_transform`]]
62 [def _external_transforms_
63 [classref boost::proto::external_transforms `proto::external_transforms<>`]]
65 [funcref boost::proto::as_expr `proto::as_expr()`]]
67 [funcref boost::proto::as_child `proto::as_child()`]]
69 [funcref boost::proto::make_expr `proto::make_expr()`]]
71 [funcref boost::proto::unpack_expr `proto::unpack_expr()`]]
73 [funcref boost::proto::display_expr `proto::display_expr()`]]
75 [classref boost::proto::matches `proto::matches<>`]]
77 [classref boost::proto::or_ `proto::or_<>`]]
79 [classref boost::proto::and_ `proto::and_<>`]]
81 [classref boost::proto::if_ `proto::if_<>`]]
83 [classref boost::proto::not_ `proto::not_<>`]]
85 [classref boost::proto::switch_ `proto::switch_<>`]]
87 [classref boost::proto::exact `proto::exact<>`]]
89 [classref boost::proto::convertible_to `proto::convertible_to<>`]]
91 [classref boost::proto::is_expr `proto::is_expr<>`]]
93 [classref boost::proto::tag_of `proto::tag_of<>`]]
95 [classref boost::proto::arity_of `proto::arity_of<>`]]
97 [funcref boost::proto::child `proto::child()`]]
99 [funcref boost::proto::child_c `proto::child_c()`]]
101 [funcref boost::proto::eval `proto::eval()`]]
103 [funcref boost::proto::left `proto::left()`]]
105 [funcref boost::proto::right `proto::right()`]]
107 [funcref boost::proto::value `proto::value()`]]
109 [classref boost::proto::terminal `proto::terminal<>`]]
111 [classref boost::proto::unary_plus `proto::unary_plus<>`]]
113 [classref boost::proto::plus `proto::plus<>`]]
115 [classref boost::proto::function `proto::function<>`]]
117 [classref boost::proto::unary_expr `proto::unary_expr<>`]]
119 [classref boost::proto::binary_expr `proto::binary_expr<>`]]
121 [classref boost::proto::nary_expr `proto::nary_expr<>`]]
123 [classref boost::proto::literal `proto::literal<>`]]
125 [funcref boost::proto::lit `proto::lit()`]]
127 [classref boost::proto::vararg `proto::vararg<>`]]
128 [def _default_context_
129 [classref boost::proto::context::default_context `proto::default_context`]]
130 [def _callable_context_
131 [classref boost::proto::context::callable_context `proto::callable_context<>`]]
133 [classref boost::proto::context::null_context `proto::null_context<>`]]
135 [classref boost::proto::when `proto::when<>`]]
137 [classref boost::proto::call `proto::call<>`]]
139 [classref boost::proto::make `proto::make<>`]]
141 [funcref boost::proto::flatten `proto::flatten()`]]
143 [classref boost::proto::_value `proto::_value`]]
145 [classref boost::proto::_child_c `proto::_child_c<>`]]
147 [classref boost::proto::_child `proto::_child`]]
149 [classref boost::proto::_left `proto::_left`]]
151 [classref boost::proto::_right `proto::_right`]]
153 [classref boost::proto::_ `proto::_`]]
155 [classref boost::proto::_expr `proto::_expr`]]
157 [classref boost::proto::_state `proto::_state`]]
159 [classref boost::proto::_data `proto::_data`]]
161 [classref boost::proto::call `proto::call<>`]]
163 [classref boost::proto::make `proto::make<>`]]
165 [classref boost::proto::_default `proto::_default<>`]]
167 [classref boost::proto::fold `proto::fold<>`]]
169 [classref boost::proto::fold_tree `proto::fold_tree<>`]]
170 [def _reverse_fold_pt_
171 [classref boost::proto::reverse_fold `proto::reverse_fold<>`]]
172 [def _reverse_fold_tree_pt_
173 [classref boost::proto::reverse_fold_tree `proto::reverse_fold_tree<>`]]
175 [classref boost::proto::generator `proto::generator<>`]]
177 [classref boost::proto::pod_generator `proto::pod_generator<>`]]
179 [classref boost::proto::deduce_domain `proto::deduce_domain`]]
181 [classref boost::proto::lazy `proto::lazy<>`]]
183 [classref boost::proto::pack `proto::pack`]]
185 [link boost_proto.users_guide.resources.SYB ["Scrap Your Boilerplate]]]
186 [def _result_of_value_
187 [classref boost::proto::result_of::value `proto::result_of::value<>`]]
188 [def _result_of_child_c_
189 [classref boost::proto::result_of::child_c `proto::result_of::child_c<>`]]
190 [def _result_of_child_
191 [classref boost::proto::result_of::child `proto::result_of::child<>`]]
192 [def _result_of_left_
193 [classref boost::proto::result_of::left `proto::result_of::left<>`]]
194 [def _result_of_right_
195 [classref boost::proto::result_of::right `proto::result_of::right<>`]]
197 [^[macroref BOOST_PROTO_MAX_ARITY]]]
198 [def _MAX_LOGICAL_ARITY_
199 [^[macroref BOOST_PROTO_MAX_LOGICAL_ARITY]]]
200 [def _MAX_FUNCTION_CALL_ARITY_
201 [^[macroref BOOST_PROTO_MAX_FUNCTION_CALL_ARITY]]]
203 [^[macroref BOOST_PROTO_BASIC_EXTENDS]()]]
205 [^[macroref BOOST_PROTO_EXTENDS]()]]
206 [def _EXTENDS_ASSIGN_
207 [^[macroref BOOST_PROTO_EXTENDS_ASSIGN]()]]
208 [def _EXTENDS_SUBSCRIPT_
209 [^[macroref BOOST_PROTO_EXTENDS_SUBSCRIPT]()]]
210 [def _EXTENDS_FUNCTION_
211 [^[macroref BOOST_PROTO_EXTENDS_FUNCTION]()]]
212 [def _DEFINE_OPERATORS_
213 [^[macroref BOOST_PROTO_DEFINE_OPERATORS]()]]
215 [^[macroref BOOST_PROTO_AUTO]()]]
217 [^[macroref BOOST_PROTO_REPEAT]()]]
218 [def _REPEAT_FROM_TO_
219 [^[macroref BOOST_PROTO_REPEAT_FROM_TO]()]]
221 [^[macroref BOOST_PROTO_REPEAT_EX]()]]
222 [def _REPEAT_FROM_TO_EX_
223 [^[macroref BOOST_PROTO_REPEAT_FROM_TO_EX]()]]
225 [^[macroref BOOST_PROTO_LOCAL_ITERATE]()]]
226 [def _BOOST_PROTO_typename_A_
227 [^[macroref BOOST_PROTO_typename_A]()]]
229 [^[macroref BOOST_PROTO_A]()]]
230 [def _BOOST_PROTO_A_const_
231 [^[macroref BOOST_PROTO_A_const]()]]
232 [def _BOOST_PROTO_A_ref_
233 [^[macroref BOOST_PROTO_A_ref]()]]
234 [def _BOOST_PROTO_A_const_ref_
235 [^[macroref BOOST_PROTO_A_const_ref]()]]
236 [def _BOOST_PROTO_A_ref_a_
237 [^[macroref BOOST_PROTO_A_ref_a]()]]
238 [def _BOOST_PROTO_A_const_ref_a_
239 [^[macroref BOOST_PROTO_A_const_ref_a]()]]
241 [^[macroref BOOST_PROTO_a]()]]
242 [def _BOOST_PROTO_ref_a_
243 [^[macroref BOOST_PROTO_ref_a]()]]
245 [include preface.qbk]
247 [/===============================]
248 [section:users_guide Users' Guide]
249 [/===============================]
251 [/===========================================================]
252 [heading Compilers, Compiler Construction Toolkits, and Proto]
253 [/===========================================================]
255 Most compilers have front ends and back ends. The front end parses the text of an input program into some intermediate form like an abstract syntax tree, and the back end takes the intermediate form and generates an executable from it.
257 A library built with Proto is essentially a compiler for an embedded domain-specific language (EDSL). It also has a front end, an intermediate form, and a back end. The front end is comprised of the symbols (a.k.a., terminals), members, operators and functions that make up the user-visible aspects of the EDSL. The back end is made of evaluation contexts and transforms that give meaning and behavior to the expression templates generated by the front end. In between is the intermediate form: the expression template itself, which is an abstract syntax tree in a very real sense.
259 To build a library with Proto, you will first decide what your interface will be; that is, you'll design a programming language for your domain and build the front end with tools provided by Proto. Then you'll design the back end by writing evaluation contexts and/or transforms that accept expression templates and do interesting things with them.
261 This users' guide is organized as follows. After a [link boost_proto.users_guide.getting_started Getting Started guide], we'll cover the tools Proto provides for defining and manipulating the three major parts of a compiler:
264 [[[link boost_proto.users_guide.front_end Front Ends]]
265 [How to define the aspects of your EDSL with which your users will interact directly.]]
266 [[[link boost_proto.users_guide.intermediate_form Intermediate Form]]
267 [What Proto expression templates look like, how to discover their structure and access their constituents.]]
268 [[[link boost_proto.users_guide.back_end Back Ends]]
269 [How to define evaluation contexts and transforms that make expression templates do interesting things.]]
272 After that, you may be interested in seeing some [link boost_proto.users_guide.examples Examples] to get a better idea of how the pieces all fit together.
274 [include getting_started.qbk]
276 [include front_end.qbk]
278 [include intermediate_form.qbk]
280 [include back_end.qbk]
282 [include examples.qbk]
284 [include resources.qbk]
286 [include glossary.qbk]
290 [xinclude reference.xml]
296 [include release_notes.qbk]
298 [include history.qbk]
300 [include rationale.qbk]
302 [include implementation.qbk]
304 [include acknowledgements.qbk]