Ocaml Stuff

Welcome to my OCaml page! I'll put all the little projects that I'm doing with OCaml here.

Sread - A Scheme-like READ for Ocaml

I wrote a small library for parsing out Scheme lists, using the ocamllex and ocamlyacc toolset. Just to ease the transition, mind you. *grin*

Here's example usage:

# Sread.read_from_string "(hello world (this (is (a (test!)))))"
- : Sread.sexpr =
 [Sread.Atom "hello"; Sread.Atom "world";
   [Sread.Atom "this";
     [Sread.Atom "is";
      Sread.List [Sread.Atom "a"; Sread.List [Sread.Atom "test!"]]]]]
It's very simple, but still pretty neat; it also supports the quotation operators.
# print_endline (Sread.string_of_sexpr 
                        "'(hello, this is `another '(test))"))
("QUOTE", ("hello", ("UNQUOTE", "this"), "is", 
           ("QUASIQUOTE", "another"), ("QUOTE", ("test"))))
- : unit = ()

The only requirement for installing it should be the findlib library.