X3 Workshop

Write a JSON Parser.

Writing a basic JSON parser with Spirit is a straightfoward task. Remember to start small and build on success.

You can find out more about JSON here:


  • Parse a simplified version of JSON
    • Treat all numerics as floating point
    • Ignore Unicode and control characters
  • Using a visitor, print out the resulting AST in JSON format
  • Add error reporting for bad parses


Docs: X3 Documentation

Slides: Using X3 Slides

Spirit X3 Source


Use the develop branch.

Zip of develop:

X3 Fun



You will find boilerplate (getting started) projects in: example/x3/rexpr
There are two directories.

  • rexpr_min - contains a single file to start things off.
  • rexpr_full - contains a structure similar to the one in the presentation complete with tests.

Remember to use a compile with c++14 capabilities:

  • clang 3.4 or greater
  • gcc 4.9 or greater