Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Scope

Metaparse is intended to be used by library authors to make their APIs follow the usual notation of the library's problem domain.

Boost.Proto is a tool for building expression templates. Expression templates can be used for DSL embedding by reinterpreting valid C++ expressions as expressions written in the DSL to embed.

This technique has the advantages over parsing the content of string literals (which is Metaparse's approach) that:

  • is faster in most cases
  • APIs using this technique can "emerge" as a process of advancing the API of a library step-by-step. Moving to a completely new DSL (with its own syntax) is a realtively big step.

Using expression templates for DSL embedding has the following disadvantages:

  • the syntax of the embededd DSL is limited. It has to be a valid C++ expression. For most libraries, people familiar with the original DSL usually need to learn the library's syntax to understand the embedded code snippets.

Proto helps embedding DSLs based on expression templates, while Metaparse helps embedding DSLs based on parsing the content of string literals.


PrevUpHomeNext