Search code examples
antlrantlr4

ANTLR4 latest version that can use C++14


I'm trying to compile the C++ code generated by ANTLR 4.10.1 for a simple grammar but I'm getting this error:

ANTLRInputStream.h:32:39: error: expected ')' before 'input' ANTLRInputStream(std::string_view input);

from what I can see, std::string_view was introduced in the C++17 standard. The compiler we use supports up to C++14, and from some google search I saw that ANTLR 4.7 can use C++14, but I was wondering how can I find out the latest ANTLR 4 version that produces C++ code that can be compiled with C++14 standard (to get most updated ANTLR fixes/functionality I can).

Any help will be appreciated.


Solution

  • The easiest way is probably to get the git repo from Github and check the file history for runtime/cpp/CMakeLists.tx. Go back until you find the switch to C++17.

    Alternatively: build the runtime yourself and revert the changes for C++17. This will also give you the latest fixes and improvements (unless they require C++17).