Skip to content
An s-expression parser written in C.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Parsing S-expressions in C

Build Status

This project is an s-expression parser written in C. I wrote this parser because I wanted to be able to store configurations as s-expressions over JSON or XML. When run the parser generates a binary tree in memory that represents the s-expression.

The supported datatypes are as follows.

  • LIST: (a b c)
  • STRING: "abc"
  • SYMBOL: abc abc-def
  • INTEGER: -123 456
  • FLOAT: -0.123 4.567

Running tests

The s-expression used for testing is located at test/data.lisp. To execute the tests run the following commands.

mkdir bin

Known Issues and Limitations

  • The parser is not capable of reading escaped characters in strings. I have no plans to address to this as my use case does not require this feature.
  • The parser has a 512 character limit on symbols, integers, floats, and strings. This can be increased by changing the BUFFER_MAX macro.
You can’t perform that action at this time.