/boombash

A Lisp Interpreter written in Python , interfacing with bash/zsh

Primary LanguagePython

BoomBash

BoomBash is teeny-tiny lisp interpreter designed to interface with Bash to provide shell commands within BoomBash. Implemented in Pure Python , this uses no external libraries.

Motivation

Writing bash scripts is very cool , but there is no functional alternative to Bash. Just as Clojure is for Java, F# for C# , Hy for Python. BoomBash is built for being a functional sibling to Bash.

The syntax is a mix between Bash and Python. Sticking to bash whenever neccessary.

This is valid syntax in BoomBash.

(print (+ 3 1 ))
(defun greet ( name ) ( output $name ))
(if (= 3 'hello')
    (print 'Equal')
  (print 'Not Equal'))

Syntax Elements

The following syntax elements are currently present

  • Variables You can set variables using the function (var name value). Example
    (var hello 'Hello')
        
  • Variable Types Variable Types include integers , boolean , and strings.
    • Integers are represented by numerals.
    • Boolean are represented by true and false
    • Strings are represented by any value inside single quotes.
  • Retrieving Value You can retrieve value of any variable using the (get name) function. Or you can use the familiar bash syntax $name.
    (get hello)
    (print $hello)
        
  • Functions You can declare functions with the familiar (defun name arguments body) syntax
    (defun hello (name)
      (print $name))
        
  • Inbuilt Functions The Inbuilt functions follow either the Python way or implemented in Bash There are plans to implement bash/coreutils functions . Currently there are functions for comparing and printing.

Current Progress

Currently language is still in building phase. Features needed

  • [ ] More Bash related functions
  • [ ] More Coreutils function
  • [ ] Threading support ?
  • [ ] Command line arguments
  • [ ] Readline in REPL
  • [x] Booleans( In the no_exec and more-types branch)
  • [x] Documentation
  • [x] More Tests(In the more-test branch)
  • [x] Interface with Bash
  • [x] Type System(In the more-types branch)
  • [x] Variable Reference
  • [x] Support for loading files
  • [x] A simple REPL
  • [x] Support for Executing Files

Usage

Currently using it means running it using python -m boombash after cloning the repository. This will open a REPL where you can try the language.

For testing just run the make test command and it will try to run the test.