Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
an experimental tiny lisp-like language written in ruby using treetop
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
autotest
bin remove unused to_s
examples
lib
spec
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
crisp.gemspec

README.md

Crisp

Crisp is an experimental language written in Ruby, using treetop.

Crisp has a Lisp syntax and immutable data structures.

The main purpose of the language is to deal with the issues and problems when creating your own programming language.

CI status

Gem Version Travis-CI Build Status Code Climate Coverage Status

Language features

  • binding values to a symbol with def
  • calculations with +, -, * and /
  • comparisons with >, < and =
  • conditional statements with if
  • loop statements with loop/recur
  • lazy sequences with lazyseq and next/take/nth
  • console output with println
  • function creation with fn
  • switch/case conditions with cond
  • local binding with let
  • dynamic loading of crisp source files with load
  • head and tail functions for array with head and tail
  • calling native ruby with .

Example

    # crisp
    >> (println "Hello World")
    Hello World
    =>
    >> (def fib (
    ?>   fn [n]
    ?>     (if (< n 2)
    ?>       n
    ?>         (+ (fib (- n 1)) (fib (- n i))))))
    => #<Crisp::Function:0x1005c2500>
    >> (fib 10)
    => 55
    >> (def factorial
    ?>   (fn [n]
    ?>     (loop [cnt n acc 1]
    ?>       (if (= 0 cnt)
    ?>         acc
    ?>         (recur (- cnt 1) (* acc cnt))))))
    => #<Crisp::Function:0x1001ad9d8>
    >> (factorial 12)
    => 479001600

For more examples see the examples directory in the repository.

Installation

    gem install crisp

Usage

To start an interactive shell: crisp

To run a crisp programm crisp /path/to/file

Something went wrong with that request. Please try again.