BitPuffin / sexpresso-c

An s-expression library for C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sexpresso-c

Sexpresso is a C centric s-expression library. It is the C version of my C++ library.

Sexpresso aims to be very simple, nodes are parsed either as s-expressions or strings, even a number would be parsed a string, so if you expect a node to be a number, please convert the string to a number!

S-expression primer

Confused? I mean what iiiis an s-expression?

s-expressions come from the lisp family of programming languages, it is an incredibly simple notation for lists, however, since these lists can be nested it also means that they are great for representing hierarchies as well, which makes it an excellent replacement for XML or JSON.

The notation is simply to surround the elements, separated by whitespace in parentheses, like this:

(here we have an s-expression)

What you see here is a list of 5 symbols: here, we, have, an and s-expression. Like I said you can also put s-expressions inside s-expressions to create hierarchies:

(my-objects 
  (object-a (name "isak andersson") 
            (countries swe uk)) 
  (object-b (name "joe bain")
            (countries uk)))

FAQ

Why should I use s-expressions

because they are more elegant and simple than XML or JSON. Much less work required to parse. And they look nice! (subjective)

Future direction

Make it a header-only library instead perhaps?

About

An s-expression library for C

License:Creative Commons Zero v1.0 Universal


Languages

Language:C 98.9%Language:Shell 1.1%