Project

crisp

0.0
No commit activity in last 3 years
No release in over 3 years
a tiny lisp-like language written in ruby using treetop.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.5.0

Runtime

>= 0
>= 0
~> 1.4.9
 Project Readme

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