Skip to content

benthepoet/c-sexpr-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
make
./bin/main

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.

About

An s-expression parser written in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published