0

I am a recent fan of s-exp expressions in Ruby. I discovered Sexpistol parser for instance.

Are you using other dedicated tools around them (schemas etc ) ?

user229044
  • 232,980
  • 40
  • 330
  • 338
JCLL
  • 5,379
  • 5
  • 44
  • 64

3 Answers3

2

You might check out Lispy: https://github.com/ryan-allen/lispy

It's no quite s-expressions, but similar in concept..

bheeshmar
  • 3,125
  • 1
  • 19
  • 18
0

The fastest lib available is sfsexp (the small, fast s-expression library). It is written in C with Ruby bindings that you can see in action in the API Doc.

sw.
  • 3,240
  • 2
  • 33
  • 43
0

I've been rolling my own handlers for s-expressions in Ruby, but I'm loving the relative ease with which they can be manipulated.

If you haven't seen Ruby's built-in Ripper library yet, it's worth checking out:

> require 'ripper'
> Ripper.sexp("1 + 1")
 => [:program, [[:binary, [:@int, "1", [1, 0]], :+, [:@int, "1", [1, 4]]]]]
Eric Walker
  • 7,063
  • 3
  • 35
  • 38
  • Where can I find what `[1, 0]` or `[1, 4]` in `@int` definition is? – EugZol Apr 26 '20 at 15:09
  • I'm not sure where these are documented. I'm guessing they're token length and number of characters into the input. They can safely be ignored. – Eric Walker May 02 '20 at 20:39
  • I found fragment from "Ruby under the microscope" book, and that part of ".sexp" output is ignored there too. Thanks for your version/guess, though, looks very probable. – EugZol May 03 '20 at 05:05