3

I was making an interpreter for a small personal project with a friend; we started implementing all the classes and general structure in which the code would be translated to then execute just to postpone the actual parsing code into these structures.

Now we have to build the parser, and after some search I found posts and people all over the place speaking about spirit Qi and spirit X3 as if they were (i think they are) 2 different ways of making a parser, but no-one saying the difference, which one is more recent, which one should i begin with.

The purpose would be, given a code string, output eventual errors, and if everything respects grammar AND logic, translate the code into a tree of the classes we already built. We'd like to check consistencies during parsing, for example the "you're using a variable that wasn't declared" kind of error.

I'm not sure how the 2 libraries treat things differently.

ThomasMcLeod
  • 7,603
  • 4
  • 42
  • 80
Barnack
  • 921
  • 1
  • 8
  • 20

1 Answers1

7

X3 is more recent, still experimental and requires C++14.

Qi is

  • more stable
  • supports more stateful options more easily
  • supports lazy parsers (which you might like)
  • is much slower to compile

The docs are

sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    "*is much slower to compile*" Just quoting to give this emphasis – as someone on a far less than state-of-the-art system, I can only say this is an understatement (even factoring in PCH). – ildjarn Oct 25 '18 at 21:28
  • 2
    @Barnack I just ran into this related answer that you might enjoy reading, it mentions many structural differences between Qi and X3 https://stackoverflow.com/questions/45457868/statefulness-of-spirit-v2-and-x3 – sehe Nov 08 '18 at 00:19