Skip to content

lispparser/sexp-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4d8096c · May 26, 2024
Jan 15, 2019
May 29, 2023
Nov 8, 2021
May 29, 2023
Dec 9, 2019
May 29, 2023
May 29, 2023
Sep 11, 2020
May 25, 2022
Aug 14, 2022
May 31, 2022
May 29, 2023
Oct 14, 2015
Nov 23, 2015
May 25, 2022
May 26, 2024
May 26, 2024
Oct 11, 2015
Oct 11, 2015
May 25, 2022
Aug 14, 2022

Repository files navigation

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