Ballz is a minimal Lisp environment written in Node.js. It was written by Dominik Hübner and Sven Pfleiderer for the Design and implementation of programming languages and virtual machines class at the Media University Stuttgart. Ballz is neither complete nor production ready, but you can install and play with it -- if you are interested.
To run Ballz, all you need is a running installation of Node.js (0.4.x). To install Node, have a look at the installation guide in the Node Wiki or run the following commands:
# Download the source package
wget http://nodejs.org/dist/node-v0.4.12.tar.gz
# Extract the sources
tar xvzf node-v0.4.12.tar.gz
cd node-v0.4.12
# Build Node
./configure --prefix=/opt/node
make
make install
# Add Node to your $PATH variable
echo 'export PATH=$PATH:/opt/node/bin' >> ~/.profile
Ballz also depends on the Eyes.js for colored object introspection. For development the Vows testing framework and the Nodelint code quality measurement tool are used.
To install these libraries, you need to install npm:
curl http://npmjs.org/install.sh | sh
After you've installed npm, you can install the dependencies by running the following command inside your Ballz.js directory:
npm install .
node bin/ballz-repl.js
or ./bin/ballz-repl.js
node bin/ballz-web-repl/ballz-web-repl.js
or ./bin/ballz-web-repl/ballz-web-repl.js
To run our unit tests, you need to install the development dependencies:
npm install . # in your ballz.js directory
After all dependencies are installed, run make test
.
To run the jslint/nodelint code quality measurement tool, just run:
make lint
(if (cond) (first-expr) (second-expr))
: evaluatesfirst-expr
ifcond
evaluates totrue
, otherwise evaluatessecond-expr
(quote (expr))
: returns expressionexpr
without evluation(eval (expr))
: explicitly evaluatesexpr
(define (symbol) (expr))
: assignsexpr
tosymbol
(lambda (arg-symbols) (body-expr))
: creates anonymous function with argumentsarg-symbols
and function bodybody-expr
(cond ((condition) (expr)) ((condition) (expr)) (else (expr)))
: evaluatesexpr
if relatedcondition
evaluates totrue
,else
is optional if nocondition
evaluated totrue
(cons (expr) (expr))
: creates pair of both expressionsexpr
(car (expr))
: evaluates to the first value of a pair(cdr (expr))
: evaluates to the second value of a pair
-
(plus (first-expr) (second-expr) … (nth-expr))
: evaluates to the sum of all expressions -
(minus (first-expr) (second-expr) … (nth-expr))
: evaluates to the substraction of all expressions -
(multiply (first-expr) (second-expr) … (nth-expr))
: evaluates to the arithmetic product of all expressosions -
(divide (first-expr) (second-expr) … (nth-expr))
: evaluates to the quotient of all expressionsBoth, floating point and integer numbers, may be used.
(and (first-expr) (second-expr) … (nth-expr))
: evaluates to the conjuntion of all expressions(or (first-expr) (second-expr) … (nth-expr))
: evaluates to the disjunction of all expressions(not (expr))
: evaluates to the logical inversion ofexpr
(xor (first-expr) (second-expr))
: evaluates to XOR of both expressions
(equals (expr) (expr))
: evaluates totrue
if bothexpr
evaluate to the same result(greaterthan (expr) (expr))
: evaluates to0
if bothexpr
evaluate to the same result, to1
if the firstexpr
is greater than the secondexpr
, to-1
if the secondexpr
is greater
(pair? (expr))
: evaluates totrue
ifexpr
is a pair, otherwise tofalse
(symbol? (expr))
: evaluates totrue
ifexpr
is a symbol, otherwise tofalse
(number? (expr))
: evaluates totrue
ifexpr
is a number, otherwise tofalse
(string? (expr))
: evaluates totrue
ifexpr
is a string, otherwise tofalse
(nil? (expr))
: evaluates totrue
ifexpr
is nil, otherwise tofalse