| Home | Libraries | People | FAQ | More

## Chapter 24. Boost.Metaparse

### Abel Sinkovics

Copyright © 2015 Abel Sinkovics

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)

## Description

Metaparse is a parser generator library for template metaprograms. The purpose of this library is to support the creation of parsers that parse at compile time. This library is intended to be used for embedded domain specific language creation for C++. The input of the generated parser is a compile time string, see `string`. The result of the parsing process is either an error or any other result the writer of the parser specifies.

The library is similar to Boost.Spirit, however while parsers built with Spirit parse at run-time, parsers built with Metaparse parse at compile-time. Parsers built with Metaparse can output:

- types
- constant values
- objects (types with public static members)
- callable C++ functions (types with public static method)
- template metafunction classes

See section What can be built from a compile-time string? for further details.

Based on C++11 features the library can provide advanced utilities for defining the input string, the rest of the library works on C++98-based compilers as well. Note that if you build the tests and examples with Boost.Build using GCC or Clang, the compiler will not have C++11 (or newer) enabled. To build the tests and examples in C++11-mode, you need to run `b2 cxxflags="-std=c++11"`.

An external tutorial can be found at https://github.com/sabel83/metaparse_tutorial#metaparse-tutorial

Last revised: July 13, 2019 at 00:08:23 GMT |