From b75f1e2491fd5443fcafc00c410ab4f769340e04 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Thu, 3 Jan 2013 16:39:46 -0500 Subject: [PATCH] added a readme --- README.md | 30 ++++++++++++++++++++++++++++++ input.scm | 25 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d2fd46a --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# skeam + +Skeam is a primitive +[Lisp](http://en.wikipedia.org/wiki/Lisp_(programming_language\)) interpreter. +I wrote this out of a curiosity to learn about the basics of writing +interpreters; it's not something that I'd recommend using, but it may be +helpful to look at if you're interested in writing your own. The name comes +from [Scheme](http://en.wikipedia.org/wiki/Scheme_(programming_language\)) and +[Skream](http://en.wikipedia.org/wiki/Skream). + +Skeam does not implement [tail-call](http://en.wikipedia.org/wiki/Tail_call) +elimination or [continuations](http://en.wikipedia.org/wiki/Continuation), so +it's not technically a Scheme implementation. + +The `input.scm` file gives an example of what is currently understood by the interpreter. + +## installing skeam + +First make sure you have Go1, the current version of the Go programming +language. If you don't have it, you can download it +[here](http://golang.org/doc/install). + +Skeam is go-gettable, so installation only requires the following command: `go +install github.com/jordanorelli/skeam`. Make sure your `$GOBIN` is included in +your environment's `$PATH`. E.g., on Mac OS X, this generally means adding +`export PATH=$PATH:/usr/local/go/bin` to your `.bashrc`. + +Once installed, you can access the Skeam REPL by simply running the command +`skeam`. To execute a Skeam file, pass the filename as a parameter to the +`skeam` command. E.g., `skeam input.scm` would run the `input.scm` file. diff --git a/input.scm b/input.scm index 5b2f2fd..ef56f19 100644 --- a/input.scm +++ b/input.scm @@ -95,3 +95,28 @@ x (counter) (counter) (counter) + +; ------------------------------------------------------------------------------ +; norving examples +; ------------------------------------------------------------------------------ + +(define area (lambda (r) (* 3.141592653 (* r r)))) +(area 3) + +; <= isn't defined yet +; (define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1)))))) +; (fact 10) + +; this one is an overflow error :( +; (fact 100) + +; (area (fact 10)) + +; (define first car) +; (define rest cdr) +; (define count +; (lambda (item L) +; (if L (+ (equal? item (first L)) (count item (rest L))) +; 0))) +; (count 0 (list 0 1 2 3 0 0)) +; (count (quote the) (quote (the more the merrier the bigger the better)))