What are the disadvantages of the Spirit parser-generator framework from boost.org?

后端 未结 5 1914
情歌与酒
情歌与酒 2021-01-30 10:48

In several questions I\'ve seen recommendations for the Spirit parser-generator framework from boost.org, but then in the comments there is grumbling from people using Spirit wh

5条回答
  •  無奈伤痛
    2021-01-30 11:12

    Here is what I don't like about it:

    • the documentation is limited. There is one big web page where "everything" is explained, but the current explanations lack in details.

    • poor AST generation. ASTs are poorly explained and, even after hitting your head against the wall to understand how the AST modifiers work, it's difficult to obtain an easy to manipulate AST (i.e. one that maps well to the problem domain)

    • It increases compilation times enormously, even for "medium"-sized grammars

    • Syntax is too heavyweight. It is a fact of life that in C/C++ you must duplicate code (i.e. between declaration and definition). However, it seems that in boost::spirit, when you declare a grammar<>, you must repeat some things 3 times :D (when you want ASTs, which is what I want :D)

    Other than this, I think they did a pretty good job with the parser, given the limitations of C++. But I think they should improve it more. The history page describes that there was a "dynamic" spirit before the current "static" spirit; I'm wondering how much faster and how much better syntax it had.

提交回复
热议问题