Dear all,
The review of the Metaparse library starts next Monday, May 25th and ends June 7th. Metaparse was written by Abel Sinkovics.
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++ and can help libraries provide a better interface.
It is similar to Boost.Spirit, however while parsers built with Spirit parse at run-time, parsers built with Metaparse parse at compile-time.
It makes it possible for library authors to provide an interface that follows the common notation of the problem domain of the library.
(eg. SQL queries, grammars, etc written in their common notation instead of similar-looking C++ expressions).
For example there is a (yet incomplete) interface for Boost.Spirit that makes it possible to write
MPLLIBS_REGEX("^[abcd][3-8]\\.foo$")
instead of
bos >> set[as_xpr('a')|'b'|'c'|'d'] >> range('3','8') >> '.' >> 'f' >> 'o' >> 'o' >> eos
and make the parser built with Metaparse generate the latter expression from the former one.
(It can be found here:
https://github.com/istvans/mpllibs/tree/master/libs/xlxpressive)
Since the library is based on template metaprogramming, the DSLs can be used for type validation as well.
This is demonstrated by the type-safe printf implementation (
http://abel.web.elte.hu/mpllibs/safe_printf/index.html).
It type-checks the arguments of a printf call based on the format string and has zero runtime overhead compared to unchecked printf.
Parsers can be constructed in a declarative manner and (even though this is template metaprogramming based) remain readable.
The implementation reflects the grammar it parses (with additional elements for semantic actions).
Even though the library requires the parser author to write template metaprograms, the development of parsers is well supported by tools like Metashell and MDB.
An important aspect of parsers (built with this library or another one) is error reporting for invalid input.
The library offers tools for the parser authors to be able to provide useful error messages in case of parsing errors.
Here is an example error report by a parser built with Metaparse (the parser can be found in the Getting Started guide of the library):
..... x__________________PARSING_FAILED__________________x<1, 5, unpaired<1, 1, literal_expected<')'>>> ....
It is an error report letting the developer know that a closing paren is missing at line 1, column 5 and the unclosed opening paren is in line 1, column 1.
Metaparse can be downloaded from Github:
https://github.com/sabel83/mpllibs/tree/master/mpllibs/metaparseAnd a very complete tutorial:
http://abel.web.elte.hu/mpllibs/metaparse/getting_started.htmlThe tutorial also offers the nice feature of a link to metashell for quick-starting trying out the library:
http://abel.web.elte.hu/shell/metashell.htmlBoost.Msm v3 also implements a new compile-time strings based front-end called eUML2 to demonstrate the power of the library and the conciseness and expressiveness it allows.
Please have a look at the documentation:
https://htmlpreview.github.io/?https://raw.githubusercontent.com/boostorg/msm/msm3/doc/HTML/ch03s05.htmlEverybody on this list is invited to participate in this formal
review. I hope to see your review of Metaparse, including your vote on
acceptance, and I welcome your participation in the ensuing discussions
on the Boost developers' mailing list.
Please always include in your review a vote as to whether the library
should be accepted into Boost.
Additionally please consider giving feedback on the following general
topics:
- What is your evaluation of the design?
- What is your evaluation of the implementation?
- What is your evaluation of the documentation?
- What is your evaluation of the potential usefulness of the library?
- Did you try to use the library?
- With what compiler?
- Did you have any problems?
- How much effort did you put into your evaluation? A glance? A quick
reading? In-depth study?
- Are you knowledgeable about the problem domain?
Regards,
Christophe
Review Manager