https://github.com/maumagnaguagno/ichor
:drop_of_blood: Fast S-expression parser for Ruby
https://github.com/maumagnaguagno/ichor
c rubygem s-expression
Last synced: 27 days ago
JSON representation
:drop_of_blood: Fast S-expression parser for Ruby
- Host: GitHub
- URL: https://github.com/maumagnaguagno/ichor
- Owner: Maumagnaguagno
- Created: 2021-12-22T23:16:31.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-02T16:04:36.000Z (6 months ago)
- Last Synced: 2024-11-02T17:17:54.378Z (6 months ago)
- Topics: c, rubygem, s-expression
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ichor [](https://github.com/Maumagnaguagno/Ichor/actions)
**Fast S-expression parser extension for Ruby**The goal of this project is to add to Ruby a fast ``String#to_sexpr`` method to parse large [symbolic expressions](https://en.wikipedia.org/wiki/S-expression).
Only atoms and lists are considered, quotes, nil and comments are currently out of scope.
Atoms are expected to be encoded in ASCII and separated by whitespaces, characters with value between 1 and 32.
An exception is raised when missing an open/close parentheses or the expression is malformed.
Parsing stops once a [NUL](https://en.wikipedia.org/wiki/Null_character) is reached.## Build
```Shell
cd Ichor
ruby extconf.rb
make
```## Usage
```Ruby
require_relative 'ichor'
p '(define example (begin () end))'.to_sexpr
``````Shell
ruby -r ./ichor.so -e "p '(+ 2 3)'.to_sexpr"
```