Boost logo

Boost :

Subject: Re: [boost] [metaparse] Practical usefulness
From: Peter Dimov (lists_at_[hidden])
Date: 2015-06-02 18:40:24


Phil Endecott wrote:
> So let me ask a question: how useful is this library in practice, beyond
> "toy examples"?
>
> Was this library developed with a real application, i.e. use in a product,
> as its motivation, or was it written to test the limits of what is
> possible using metaprogramming?
>
> My first reaction to the library was "cool!". My second reaction was
> "it's a toy to demonstrate metaprogramming". Then I saw the printf()
> example and my third (and for now final!) though is that, yes, this could
> be useful.

The presentation at

http://abel.sinkovics.hu/download.php?fn=2014_dsl.pdf

is a very good illustration of the potential use cases of the library and
the current alternatives that are commonly employed. It uses a regular
expression parser as an example, but embedded SQL could be another good one.

In short, it enables compile-time embedded domain-specific languages (EDSLs)
to not be constrained by the C++ syntax. You write your regular expression
as a string and the Metaparse parser compiles it into a C++ regexp matching
engine for the expression.

Another interesting example would be your writing a grammar for a language
in EBNF (instead of Spirit syntax) and Metaparse generating the (runtime)
parser from that. (Interestingly, Metaparse can currently take a grammar in
EBNF and generate the compile-time parser from it. :-))


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk