Is the ANTLR parser generator best for a C++ app with constrained memory?

前端 未结 7 1662
粉色の甜心
粉色の甜心 2021-02-06 08:10

I\'m looking for a good parser generator that I can use to read a custom text-file format in our large commercial app. Currently this particular file format is read with a handm

7条回答
  •  囚心锁ツ
    2021-02-06 08:30

    We use Boost Spirit successfully in our application. The Boost license is a very liberal one, so there is no problem using it in commercial applications.

    Quote from the documentation:

    Spirit is an object-oriented recursive-descent parser generator framework implemented using template meta-programming techniques. Expression templates allow us to approximate the syntax of Extended Backus-Normal Form (EBNF) completely in C++. The Spirit framework enables a target grammar to be written exclusively in C++. Inline EBNF grammar specifications can mix freely with other C++ code and, thanks to the generative power of C++ templates, are immediately executable. In retrospect, conventional compiler-compilers or parser-generators have to perform an additional translation step from the source EBNF code to C or C++ code.

提交回复
热议问题