alandipert / gherkin

a functional programming language and interpreter written in GNU Bash 4
https://tailrecursion.com/~alan/Lisp/GherkinHistory.html
BSD 3-Clause "New" or "Revised" License
522 stars 31 forks source link

This project is dormant. I have not worked on it in years, and am unlikely to continue work on it anytime soon. I encourage you to check out "mal" -- "Make a Lisp" -- by Joel Martin, a project inspired by this one, that includes implementations in dozens of languages, including Bash: https://github.com/kanaka/mal. While it's missing garbage collection, mal's Bash Lisp is incredibly clean and easy to hack on. For additional historical perspective, see this article on my homepage.

gherkin

gherkin logo

gherkin is a functional programming language and interpreter written in GNU Bash 4 designed for extreme portability across *nix platforms. For rationale, see Why gherkin?

gherkin is a dialect of Lisp, and like other Lisps such as Clojure and [Scheme](http://en.wikipedia.org/wiki/Scheme_(programming_language) it features homoiconicity, first-class functions, and primitive functions for operating on a variety of data types such as strings, integers, symbols, and lists. As a citizen of nix and the shell environment, it also provides nix and shell interoperation facilities.

gherkin is currently alpha status, but our hope is to continue feature development until gherkin can be used in place of Bash for general purpose *nix scripting. If you're curious about our progress toward our first release, see our milestones.

Try gherkin

gherkin requires GNU Bash version 4 or higher. If you're on Linux, this is probably already your shell. If you're on a Mac, we recommend you install a recent version of Bash with Homebrew.

REPL

Start a Read-Evaluate-Print-Loop (REPL) and evaluate a simple expression:

./gherkin
> (+ 1 2)
3

You may exit the REPL with Ctrl-D.

Running a script

Run fib.gk to find the 60th Fibonacci number:

./gherkin -l fib.gk

Start a REPL and try a core library function:

./gherkin
> (load-file "core")
nil
> (map inc '(1 2 3))
(2 3 4)

You may also load the core library and start a REPL with ./gherkin -l core.gk -r.

Learning more & getting involved

gherkin is brand new, under active development, and not yet formally released. As such, its usage is error-prone and its documentation spotty. If you'd like to help us improve gherkin, its documentation, or have any questions, please join us:

Related tools

Thanks