Skip to content

Maumagnaguagno/Ichor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ichor Actions Status

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. 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 is reached.

Build

cd Ichor
ruby extconf.rb
make

Usage

require_relative 'ichor'
p '(define example (begin () end))'.to_sexpr
ruby -r ./ichor.so -e "p '(+ 2 3)'.to_sexpr"