A S-Expression Parser for C++

Marty 7fc7dc0fb1 Merge pull request #1 from swagtoy/master 2 tygodni temu
benchmarks 9cbadbde87 Fix clang-tidy warnings 6 lat temu
external 3883208051 Update flake.nix to nixos-23.05 1 rok temu
include 092d579ab6 Add forward declarations header 3 lat temu
pkgconfig 17329bb93b Add pkgconfig file 5 lat temu
src 5e64c4c821 Use stringstream for string2float 2 tygodni temu
tests 6829f58196 Remove USE_LOCALE, no longer necessary with C++20 1 rok temu
.clang-tidy 03cffbd19a Use external/cmake-modules/ClangTidy.cmake instead of manually 4 lat temu
.gitattributes 6810961ea2 Add VERSION file 2 lat temu
.gitignore ade5eb3193 Reorganize flake.nix to allow cross-compiling 2 lat temu
.gitmodules 3ba590de5e Update flake.nix to nixos-22.05 2 lat temu
CMakeLists.txt 684a8a134f Remove more more tinycmmc 1 miesiąc temu
LICENSE.txt 9beb751a57 Added copy of GPLv3 9 lat temu
README.md 4ebe3e1a2a Added use_arrays flag to Parser to handle all lists as arrays 9 lat temu
VERSION 6810961ea2 Add VERSION file 2 lat temu
flake.lock a6e5a8ec61 Update to nixos-24.05 7 miesięcy temu
flake.nix a6e5a8ec61 Update to nixos-24.05 7 miesięcy temu
logo.png e5c0ae69da Added logo 9 lat temu
logo.svg e5c0ae69da Added logo 9 lat temu
sexp-config.cmake.in 9318a730e1 Use @PACKAGE_INIT@ in sexp-config.cmake.in 2 lat temu
sexpcpp.nix ade5eb3193 Reorganize flake.nix to allow cross-compiling 2 lat temu

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").