proto.qbk 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. [library Boost.Proto
  2. [quickbook 1.3]
  3. [authors [Niebler, Eric]]
  4. [copyright 2008 Eric Niebler]
  5. [category template]
  6. [id proto]
  7. [dirname proto]
  8. [purpose
  9. Generic expression template, grammar and
  10. tree-transformation framework.
  11. ]
  12. [license
  13. Distributed under the Boost Software License, Version 1.0.
  14. (See accompanying file LICENSE_1_0.txt or copy at
  15. [@http://www.boost.org/LICENSE_1_0.txt])
  16. ]
  17. ]
  18. [/
  19. / Copyright (c) 2008 Eric Niebler
  20. /
  21. / Distributed under the Boost Software License, Version 1.0. (See accompanying
  22. / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  23. /]
  24. [/ QuickBook Document version 1.3 ]
  25. [/ Images ]
  26. [def __note__ [$images/note.png]]
  27. [def __alert__ [$images/caution.png]]
  28. [def __detail__ [$images/note.png]]
  29. [def __tip__ [$images/tip.png]]
  30. [/ Links ]
  31. [def _PETE_
  32. [@http://acts.nersc.gov/formertools/pete/index.html PETE]]
  33. [def _spirit_fx_
  34. [@http://spirit.sourceforge.net Spirit Parser Framework]]
  35. [def _spirit_
  36. [@http://spirit.sourceforge.net Spirit]]
  37. [def _xpressive_
  38. [@../../libs/xpressive/index.html Boost.Xpressive]]
  39. [def _typeof_
  40. [@../../libs/typeof/index.html Boost.Typeof]]
  41. [def _expr_
  42. [classref boost::proto::expr `proto::expr<>`]]
  43. [def _basic_expr_
  44. [classref boost::proto::basic_expr `proto::basic_expr<>`]]
  45. [def _deep_copy_
  46. [funcref boost::proto::deep_copy `proto::deep_copy()`]]
  47. [def _domain_
  48. [classref boost::proto::domain `proto::domain<>`]]
  49. [def _default_domain_
  50. [classref boost::proto::default_domain `proto::default_domain`]]
  51. [def _extends_
  52. [classref boost::proto::extends `proto::extends<>`]]
  53. [def _external_transform_
  54. [classref boost::proto::external_transform `proto::external_transform`]]
  55. [def _external_transforms_
  56. [classref boost::proto::external_transforms `proto::external_transforms<>`]]
  57. [def _as_expr_
  58. [funcref boost::proto::as_expr `proto::as_expr()`]]
  59. [def _as_child_
  60. [funcref boost::proto::as_child `proto::as_child()`]]
  61. [def _make_expr_
  62. [funcref boost::proto::make_expr `proto::make_expr()`]]
  63. [def _unpack_expr_
  64. [funcref boost::proto::unpack_expr `proto::unpack_expr()`]]
  65. [def _display_expr_
  66. [funcref boost::proto::display_expr `proto::display_expr()`]]
  67. [def _matches_
  68. [classref boost::proto::matches `proto::matches<>`]]
  69. [def _or_
  70. [classref boost::proto::or_ `proto::or_<>`]]
  71. [def _and_
  72. [classref boost::proto::and_ `proto::and_<>`]]
  73. [def _if_
  74. [classref boost::proto::if_ `proto::if_<>`]]
  75. [def _not_
  76. [classref boost::proto::not_ `proto::not_<>`]]
  77. [def _switch_
  78. [classref boost::proto::switch_ `proto::switch_<>`]]
  79. [def _exact_
  80. [classref boost::proto::exact `proto::exact<>`]]
  81. [def _convertible_to_
  82. [classref boost::proto::convertible_to `proto::convertible_to<>`]]
  83. [def _is_expr_
  84. [classref boost::proto::is_expr `proto::is_expr<>`]]
  85. [def _tag_of_
  86. [classref boost::proto::tag_of `proto::tag_of<>`]]
  87. [def _arity_of_
  88. [classref boost::proto::arity_of `proto::arity_of<>`]]
  89. [def _child_
  90. [funcref boost::proto::child `proto::child()`]]
  91. [def _child_c_
  92. [funcref boost::proto::child_c `proto::child_c()`]]
  93. [def _eval_
  94. [funcref boost::proto::eval `proto::eval()`]]
  95. [def _left_
  96. [funcref boost::proto::left `proto::left()`]]
  97. [def _right_
  98. [funcref boost::proto::right `proto::right()`]]
  99. [def _value_
  100. [funcref boost::proto::value `proto::value()`]]
  101. [def _terminal_
  102. [classref boost::proto::terminal `proto::terminal<>`]]
  103. [def _unary_plus_
  104. [classref boost::proto::unary_plus `proto::unary_plus<>`]]
  105. [def _plus_
  106. [classref boost::proto::plus `proto::plus<>`]]
  107. [def _function_
  108. [classref boost::proto::function `proto::function<>`]]
  109. [def _unary_expr_
  110. [classref boost::proto::unary_expr `proto::unary_expr<>`]]
  111. [def _binary_expr_
  112. [classref boost::proto::binary_expr `proto::binary_expr<>`]]
  113. [def _nary_expr_
  114. [classref boost::proto::nary_expr `proto::nary_expr<>`]]
  115. [def _literal_
  116. [classref boost::proto::literal `proto::literal<>`]]
  117. [def _lit_
  118. [funcref boost::proto::lit `proto::lit()`]]
  119. [def _vararg_
  120. [classref boost::proto::vararg `proto::vararg<>`]]
  121. [def _default_context_
  122. [classref boost::proto::context::default_context `proto::default_context`]]
  123. [def _callable_context_
  124. [classref boost::proto::context::callable_context `proto::callable_context<>`]]
  125. [def _null_context_
  126. [classref boost::proto::context::null_context `proto::null_context<>`]]
  127. [def _when_
  128. [classref boost::proto::when `proto::when<>`]]
  129. [def _call_
  130. [classref boost::proto::call `proto::call<>`]]
  131. [def _make_
  132. [classref boost::proto::make `proto::make<>`]]
  133. [def _flatten_
  134. [funcref boost::proto::flatten `proto::flatten()`]]
  135. [def _value_pt_
  136. [classref boost::proto::_value `proto::_value`]]
  137. [def _child_c_pt_
  138. [classref boost::proto::_child_c `proto::_child_c<>`]]
  139. [def _child_pt_
  140. [classref boost::proto::_child `proto::_child`]]
  141. [def _left_pt_
  142. [classref boost::proto::_left `proto::_left`]]
  143. [def _right_pt_
  144. [classref boost::proto::_right `proto::_right`]]
  145. [def _wild_
  146. [classref boost::proto::_ `proto::_`]]
  147. [def _expr_pt_
  148. [classref boost::proto::_expr `proto::_expr`]]
  149. [def _state_pt_
  150. [classref boost::proto::_state `proto::_state`]]
  151. [def _data_pt_
  152. [classref boost::proto::_data `proto::_data`]]
  153. [def _call_pt_
  154. [classref boost::proto::call `proto::call<>`]]
  155. [def _make_pt_
  156. [classref boost::proto::make `proto::make<>`]]
  157. [def _default_pt_
  158. [classref boost::proto::_default `proto::_default<>`]]
  159. [def _fold_pt_
  160. [classref boost::proto::fold `proto::fold<>`]]
  161. [def _fold_tree_pt_
  162. [classref boost::proto::fold_tree `proto::fold_tree<>`]]
  163. [def _reverse_fold_pt_
  164. [classref boost::proto::reverse_fold `proto::reverse_fold<>`]]
  165. [def _reverse_fold_tree_pt_
  166. [classref boost::proto::reverse_fold_tree `proto::reverse_fold_tree<>`]]
  167. [def _generator_
  168. [classref boost::proto::generator `proto::generator<>`]]
  169. [def _pod_generator_
  170. [classref boost::proto::pod_generator `proto::pod_generator<>`]]
  171. [def _deduce_domain_
  172. [classref boost::proto::deduce_domain `proto::deduce_domain`]]
  173. [def _lazy_pt_
  174. [classref boost::proto::lazy `proto::lazy<>`]]
  175. [def _pack_
  176. [classref boost::proto::pack `proto::pack`]]
  177. [def _SYB_
  178. [link boost_proto.users_guide.resources.SYB ["Scrap Your Boilerplate]]]
  179. [def _result_of_value_
  180. [classref boost::proto::result_of::value `proto::result_of::value<>`]]
  181. [def _result_of_child_c_
  182. [classref boost::proto::result_of::child_c `proto::result_of::child_c<>`]]
  183. [def _result_of_child_
  184. [classref boost::proto::result_of::child `proto::result_of::child<>`]]
  185. [def _result_of_left_
  186. [classref boost::proto::result_of::left `proto::result_of::left<>`]]
  187. [def _result_of_right_
  188. [classref boost::proto::result_of::right `proto::result_of::right<>`]]
  189. [def _MAX_ARITY_
  190. [^[macroref BOOST_PROTO_MAX_ARITY]]]
  191. [def _MAX_LOGICAL_ARITY_
  192. [^[macroref BOOST_PROTO_MAX_LOGICAL_ARITY]]]
  193. [def _MAX_FUNCTION_CALL_ARITY_
  194. [^[macroref BOOST_PROTO_MAX_FUNCTION_CALL_ARITY]]]
  195. [def _BASIC_EXTENDS_
  196. [^[macroref BOOST_PROTO_BASIC_EXTENDS]()]]
  197. [def _EXTENDS_
  198. [^[macroref BOOST_PROTO_EXTENDS]()]]
  199. [def _EXTENDS_ASSIGN_
  200. [^[macroref BOOST_PROTO_EXTENDS_ASSIGN]()]]
  201. [def _EXTENDS_SUBSCRIPT_
  202. [^[macroref BOOST_PROTO_EXTENDS_SUBSCRIPT]()]]
  203. [def _EXTENDS_FUNCTION_
  204. [^[macroref BOOST_PROTO_EXTENDS_FUNCTION]()]]
  205. [def _DEFINE_OPERATORS_
  206. [^[macroref BOOST_PROTO_DEFINE_OPERATORS]()]]
  207. [def _AUTO_
  208. [^[macroref BOOST_PROTO_AUTO]()]]
  209. [def _REPEAT_
  210. [^[macroref BOOST_PROTO_REPEAT]()]]
  211. [def _REPEAT_FROM_TO_
  212. [^[macroref BOOST_PROTO_REPEAT_FROM_TO]()]]
  213. [def _REPEAT_EX_
  214. [^[macroref BOOST_PROTO_REPEAT_EX]()]]
  215. [def _REPEAT_FROM_TO_EX_
  216. [^[macroref BOOST_PROTO_REPEAT_FROM_TO_EX]()]]
  217. [def _LOCAL_ITERATE_
  218. [^[macroref BOOST_PROTO_LOCAL_ITERATE]()]]
  219. [def _BOOST_PROTO_typename_A_
  220. [^[macroref BOOST_PROTO_typename_A]()]]
  221. [def _BOOST_PROTO_A_
  222. [^[macroref BOOST_PROTO_A]()]]
  223. [def _BOOST_PROTO_A_const_
  224. [^[macroref BOOST_PROTO_A_const]()]]
  225. [def _BOOST_PROTO_A_ref_
  226. [^[macroref BOOST_PROTO_A_ref]()]]
  227. [def _BOOST_PROTO_A_const_ref_
  228. [^[macroref BOOST_PROTO_A_const_ref]()]]
  229. [def _BOOST_PROTO_A_ref_a_
  230. [^[macroref BOOST_PROTO_A_ref_a]()]]
  231. [def _BOOST_PROTO_A_const_ref_a_
  232. [^[macroref BOOST_PROTO_A_const_ref_a]()]]
  233. [def _BOOST_PROTO_a_
  234. [^[macroref BOOST_PROTO_a]()]]
  235. [def _BOOST_PROTO_ref_a_
  236. [^[macroref BOOST_PROTO_ref_a]()]]
  237. [include preface.qbk]
  238. [/===============================]
  239. [section:users_guide Users' Guide]
  240. [/===============================]
  241. [/===========================================================]
  242. [heading Compilers, Compiler Construction Toolkits, and Proto]
  243. [/===========================================================]
  244. 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.
  245. 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.
  246. 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.
  247. 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:
  248. [variablelist
  249. [[[link boost_proto.users_guide.front_end Front Ends]]
  250. [How to define the aspects of your EDSL with which your users will interact directly.]]
  251. [[[link boost_proto.users_guide.intermediate_form Intermediate Form]]
  252. [What Proto expression templates look like, how to discover their structure and access their constituents.]]
  253. [[[link boost_proto.users_guide.back_end Back Ends]]
  254. [How to define evaluation contexts and transforms that make expression templates do interesting things.]]
  255. ]
  256. 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.
  257. [include getting_started.qbk]
  258. [include front_end.qbk]
  259. [include intermediate_form.qbk]
  260. [include back_end.qbk]
  261. [include examples.qbk]
  262. [include resources.qbk]
  263. [include glossary.qbk]
  264. [endsect]
  265. [xinclude reference.xml]
  266. [/=================]
  267. [section Appendices]
  268. [/=================]
  269. [include release_notes.qbk]
  270. [include history.qbk]
  271. [include rationale.qbk]
  272. [include implementation.qbk]
  273. [include acknowledgements.qbk]
  274. [endsect]