1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5 <title>Chapter 24. Boost.Metaparse</title>
6 <link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
7 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8 <link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9 <link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)">
10 <link rel="prev" href="tribool/tests.html" title="Testsuite">
11 <link rel="next" href="metaparse/related_publications_and_blogs.html" title="Related publications and blogs">
13 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14 <table cellpadding="2" width="100%"><tr>
15 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
16 <td align="center"><a href="../../index.html">Home</a></td>
17 <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
18 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20 <td align="center"><a href="../../more/index.htm">More</a></td>
23 <div class="spirit-nav">
24 <a accesskey="p" href="tribool/tests.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="metaparse/related_publications_and_blogs.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
27 <div class="titlepage"><div>
28 <div><h2 class="title">
29 <a name="metaparse"></a>Chapter 24. Boost.Metaparse</h2></div>
30 <div><div class="author"><h3 class="author">
31 <span class="firstname">Abel</span> <span class="surname">Sinkovics</span>
33 <div><p class="copyright">Copyright © 2015 Abel Sinkovics</p></div>
34 <div><div class="legalnotice">
35 <a name="metaparse.legal"></a><p>
36 Distributed under the Boost Software License, Version 1.0. (See accompanying
37 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
42 <p><b>Table of Contents</b></p>
44 <dt><span class="section"><a href="metaparse.html#metaparse.description">Description</a></span></dt>
45 <dt><span class="section"><a href="metaparse/related_publications_and_blogs.html">Related publications
46 and blogs</a></span></dt>
47 <dt><span class="section"><a href="metaparse/preface.html">Preface</a></span></dt>
49 <dt><span class="section"><a href="metaparse/preface.html#metaparse.preface.description">Description</a></span></dt>
50 <dt><span class="section"><a href="metaparse/preface.html#metaparse.preface.scope">Scope</a></span></dt>
51 <dt><span class="section"><a href="metaparse/preface.html#metaparse.preface.advantages_of_using_this_library">Advantages
52 of using this library</a></span></dt>
53 <dt><span class="section"><a href="metaparse/preface.html#metaparse.preface.cost_of_using_metaparse">Cost of using
54 Metaparse</a></span></dt>
55 <dt><span class="section"><a href="metaparse/preface.html#metaparse.preface.supported_platforms">Supported platforms</a></span></dt>
57 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html">Getting
58 started with Boost.Metaparse</a></span></dt>
60 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.1_introduction">1.
61 Introduction</a></span></dt>
62 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.2_the_text_to_parse">2.
63 The text to parse</a></span></dt>
64 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.3_creating_a_simple_parser">3.
65 Creating a simple parser</a></span></dt>
66 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.4_parsing_simple_expressions">4.
67 Parsing simple expressions</a></span></dt>
68 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.5_parsing_longer_expressions">5.
69 Parsing longer expressions</a></span></dt>
70 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.6_adding_support_for_other_opera">6.
71 Adding support for other operators</a></span></dt>
72 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.7_dealing_with_precedence">7.
73 Dealing with precedence</a></span></dt>
74 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.8_dealing_with_associativity">8.
75 Dealing with associativity</a></span></dt>
76 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.9_dealing_with_unary_operators">9.
77 Dealing with unary operators</a></span></dt>
78 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.10_dealing_with_parens">10.
79 Dealing with parens</a></span></dt>
80 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.11_dealing_with_invalid_input">11.
81 Dealing with invalid input</a></span></dt>
82 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.12_summary">12.
83 Summary</a></span></dt>
84 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.copy_paste_friendly_code_example">Copy-paste
85 friendly code examples</a></span></dt>
86 <dt><span class="section"><a href="metaparse/getting_started_with_boost_metap.html#metaparse.getting_started_with_boost_metap.definitions_before_each_section">Definitions
87 before each section</a></span></dt>
89 <dt><span class="section"><a href="metaparse/user_manual.html">User manual</a></span></dt>
91 <dt><span class="section"><a href="metaparse/user_manual.html#metaparse.user_manual.what_is_a_parser">What is a parser</a></span></dt>
92 <dt><span class="section"><a href="metaparse/user_manual.html#metaparse.user_manual.parsing_based_on_constexpr">Parsing
93 based on <code class="computeroutput"><span class="keyword">constexpr</span></code></a></span></dt>
94 <dt><span class="section"><a href="metaparse/user_manual.html#metaparse.user_manual.what_types_of_grammars_can_be_us">What
95 types of grammars can be used?</a></span></dt>
97 <dt><span class="section"><a href="metaparse/versioning.html">Versioning</a></span></dt>
99 <dt><span class="section"><a href="metaparse/versioning.html#metaparse.versioning.template_classes">Template classes</a></span></dt>
100 <dt><span class="section"><a href="metaparse/versioning.html#metaparse.versioning.macros">Macros</a></span></dt>
102 <dt><span class="section"><a href="metaparse/performance.html">Performance</a></span></dt>
104 <dt><span class="section"><a href="metaparse/performance.html#metaparse.performance.benchmarks_of_boost_metaparse_st">Benchmarks
105 of BOOST_METAPARSE_STRING</a></span></dt>
106 <dt><span class="section"><a href="metaparse/performance.html#metaparse.performance.measuring_printf">Measuring printf</a></span></dt>
107 <dt><span class="section"><a href="metaparse/performance.html#metaparse.performance.further_measurements">Further measurements</a></span></dt>
109 <dt><span class="section"><a href="metaparse/the_design_of_the_library.html">The design of the
110 library</a></span></dt>
111 <dd><dl><dt><span class="section"><a href="metaparse/the_design_of_the_library.html#metaparse.the_design_of_the_library.design_rationale">Design
112 rationale</a></span></dt></dl></dd>
113 <dt><span class="section"><a href="metaparse/reference.html">Reference</a></span></dt>
115 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.parsers_and_combinators_provided">Parsers
116 and combinators provided by the library</a></span></dt>
117 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.compile_time_data_structures_and">Compile-time
118 data structures and values</a></span></dt>
119 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.string">String</a></span></dt>
120 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.errors">Errors</a></span></dt>
121 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.tags">Tags</a></span></dt>
122 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.utilities">Utilities</a></span></dt>
123 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.terms_used_by_the_library">Terms
124 used by the library</a></span></dt>
125 <dt><span class="section"><a href="metaparse/reference.html#metaparse.reference.alphabetical">Alphabetical</a></span></dt>
129 <div class="section">
130 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
131 <a name="metaparse.description"></a><a class="link" href="metaparse.html#metaparse.description" title="Description">Description</a>
132 </h2></div></div></div>
134 Metaparse is a parser generator library for template metaprograms. The purpose
135 of this library is to support the creation of parsers that parse at compile
136 time. This library is intended to be used for embedded domain specific language
137 creation for C++. The input of the generated parser is a compile time string,
138 see <a class="link" href="metaparse/reference.html#string"><code class="computeroutput"><span class="identifier">string</span></code></a>.
139 The result of the parsing process is either an error or any other result the
140 writer of the parser specifies.
143 The library is similar to Boost.Spirit, however while parsers built with Spirit
144 parse at run-time, parsers built with Metaparse parse at compile-time. Parsers
145 built with Metaparse can output:
147 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
148 <li class="listitem">
151 <li class="listitem">
154 <li class="listitem">
155 objects (types with public static members)
157 <li class="listitem">
158 callable C++ functions (types with public static method)
160 <li class="listitem">
161 template metafunction classes
165 See section <a class="link" href="metaparse/user_manual.html#result_types">What can be built from a compile-time
166 string?</a> for further details.
169 Based on C++11 features the library can provide advanced utilities for defining
170 the input string, the rest of the library works on C++98-based compilers as
171 well. Note that if you build the tests and examples with Boost.Build using
172 GCC or Clang, the compiler will not have C++11 (or newer) enabled. To build
173 the tests and examples in C++11-mode, you need to run <code class="computeroutput"><span class="identifier">b2</span>
174 <span class="identifier">cxxflags</span><span class="special">=</span><span class="string">"-std=c++11"</span></code>.
177 An external tutorial can be found at <a href="https://github.com/sabel83/metaparse_tutorial#metaparse-tutorial" target="_top">https://github.com/sabel83/metaparse_tutorial#metaparse-tutorial</a>
181 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
182 <td align="left"><p><small>Last revised: December 10, 2019 at 00:26:27 GMT</small></p></td>
183 <td align="right"><div class="copyright-footer"></div></td>
186 <div class="spirit-nav">
187 <a accesskey="p" href="tribool/tests.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="metaparse/related_publications_and_blogs.html"><img src="../../doc/src/images/next.png" alt="Next"></a>