A S-Expression Parser for C++

Ingo Ruhnke 6018831abc Add missing <sstream> include 2 years ago
benchmarks 9cbadbde87 Fix clang-tidy warnings 2 years ago
external 8916bef706 Update external/ libaries 2 years ago
include 9cbadbde87 Fix clang-tidy warnings 2 years ago
src 6018831abc Add missing <sstream> include 2 years ago
tests 98f3df319d Fix size test case under MSVC x64 2 years ago
.appveyor.yml 1830cba224 Do Appveyor build with x86/x64 and Debug/Release 2 years ago
.clang-tidy 47c6398251 Add clang-tidy configuration 2 years ago
.gitignore 44b4037dac More .gitignore 2 years ago
.gitlab-ci.yml caca0ea9f8 Enabled benchmark building in .gitlab-ci.yml 3 years ago
.gitmodules 44ffa83e81 Added googletest and google-benchmark submodules 5 years ago
.travis.yml f30a01d2d2 Install language-pack to avoid: 5 years ago
CMakeLists.txt 8abec55cfb Add clang-tidy support to CMakeLists.txt 2 years ago
LICENSE.txt 9beb751a57 Added copy of GPLv3 5 years ago
README.md 4ebe3e1a2a Added use_arrays flag to Parser to handle all lists as arrays 5 years ago
logo.png e5c0ae69da Added logo 5 years ago
logo.svg e5c0ae69da Added logo 5 years ago

README.md

Build Status

SExp - A S-Expression Parser for C++

SExp is an S-Expression parser for C++.

Example Code:

sexp::Value value = sexp::Parser::from_string("(1 2 3 4 5)")
sexpr::Value const& head = value.get_car();
sexpr::Value const& tail = value.get_cdr();
if (head.is_integer())
{
   std::cout << head.as_int() << std::endl;
}

Arrays vs Cons

When dealing with large amounts of data the classic Scheme list comes with quite abit of a performance penentaly, for this reason SExp allows you to interpret all list as arrays:

sexp::Parser::from_stream(fin, sexp::Parser::USE_ARRAYS);

C++ locales

If C++ locales are used in your code, compile with:

cmake -DSEXP_USE_LOCALE=ON

Otherwise the input and output functions will produce incorrect results (i.e. "1,5" instead of "1.5").