Posted on 2018-09-12 19:30 by Timo Bingmann at Permlink with 0 Comments. Tags: talk c++ parsing
On September 12th, 2018, I gave another 90min talk with live-coding examples in German at the C++ User Group Karlsruhe in rooms of the Karlsruhe Institute of Technology (KIT).
This time I was asked to present a more advanced topic around C++ and libraries and I chose to present a tutorial on Boost.Spirit.
Boost.Spirit is a parser and generator template meta-programming framework and maybe one of the most crazy and advanced uses of C++. It enables one to write context-free grammars inline as C++ code, which are translated into recursive descent parsers and fully optimized by the compiler.
This powerful framework is however not easy to get started with. I hope my tutorial helps more people to skip the steep learning curve and use Boost.Spirit for securely parsing user input and other structure data.
The tutorial consisted of a set of introduction slides: slides-2018-09-12-Cpp-Meetup.pdf . Followed by a live-coding session in German which was recorded by the KIT (see below for the youtube video).
The extensive code examples presented in the live coding session are available on this webpage
or on github: https://github.com/bingmann/2018-cpp-spirit-parsing.
The examples can be seen as instructive templates and copy & paste sources for new development. The examples are:
5
, [5, 42, 69, 256]
.5 + 6 * 9 + 42
and evaluate correctly.AAPL;Apple;252.50;
into a struct.y = 6 * 9 + 42 * x
and evaluate with variables.<h1>Example for <b>C++ HTML Parser<b></h1>
This HTML <b>snippet</b> parser can also interpret
*Markdown* style and enables additional tags
to <% invoke("C++", 42) %> functions.