- this a simple RSR5 Scheme implementation done in c++
- project is called sexp_cpp (it morphed out of a s-expressions interpreter)
- this is work in progress project! Scheme implementation is not complete yet!
- it's developed and tested on mac so it might not work strait out of the box on Linux (but it will in a future)
- compilers: clang or g++ (any modern will do)
- boost (any modern will do)
- ruby and rake (for Rakefile, learn about it here)
- googletest for functional and unit tests
- Project is tested on MacOs 10.6
- Rakefile expects BOOST_INC env variable to be set
- Rakefile expects googletest to be installed in /opt/local/lib
- Clone git repo from github
git clone git://github.com/nazgob/sexp_cpp.git
- Change directory to sex_cpp
cd sex_cpp
- Use rake lib to build lib
rake lib
- Use rake exec to build interpreter itself
rake exec
- Use rake test to build tests (if you have googletest installed)
rake test
- Use rake run to run tests
rake run
- Use rake (default task) to build lib, tests and run tests with one command
rake
- Run interpreter and play with Scheme
bin/sexp
- Stop interpreter session with CTRL-C
^C
- Have fun! :)
[sexp_cpp (master)]$ bin/sexp
sexp> 123
123
sexp> -456
-456
sexp> #t
#t
sexp> #f
#f
sexp> "foobar"
eval crashed => trying to eval NULL!
NULL
sexp> (quote (1 2 3))
(1 2 3)
sexp> '(1 2 3)
(1 2 3)
sexp> (define foo 55)
ok
sexp> foo
55
sexp> (set! foo 42)
ok
sexp> foo
42
sexp> (if #t 1 2)
1
sexp> (if #t (quote 1) 42))
1
sexp> (+ 1 2 3 4 5)
15
sexp> (null? (+ 1 2))
#f
sexp> (null? ())
#t
sexp> (boolean? #f)
#t
sexp> (define bazz 5)
ok
sexp> (define bar 7)
ok
sexp> (+ bazz bar)
12
sexp> ((lambda (x) (+ x 2)) 42)
44
- Check if you have Rake, its bundled with Ruby 1.9 but if you're on 1.8 you
might need to install it:
Mac:sudo port install rake
Ubuntu:sudo apt-get install rake
Copyright (c) 2011 Przemek Owczarek, released under the MIT license