Welcome to my OCaml page! I'll put all the little projects that I'm doing with OCaml here.
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.List
[Sread.Atom "hello"; Sread.Atom "world";
Sread.List
[Sread.Atom "this";
Sread.List
[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
(Sread.read_from_string
"'(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.