Skip to content

Lisp interpreter in Haskell, because I wanted to learn parser combinators

Notifications You must be signed in to change notification settings

stickyPiston/hs-lisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hs-lisp

Another flavour of lisp created in haskell

Features

This lisp has

  • Built-in currying
  • Unicode name support
  • Definition of recursive functions
  • Wildcards (like (- _ 1) ≡ (λ (x) (- x 1)))
  • Functions for I/O (read, write, open, close)
  • Still lots of bugs

Example

(define ∅? null)
(define-rec (foldl f s l)
  (if (∅? (cdr l))
    (f s (car l))
    (f (foldl f s (cdr l)) (car l))))
(define (∘ f g) (λ (x) (f (g x))))
(define ->> (foldl ∘ (λ (x) x)))
(define (main args) (print ((->> '((+ 1) (+ 3) (- _ 4) (* 2))) 10)))
; prints 20

Building

Make sure you have cabal installed, then run cabal run or cabal repl

About

Lisp interpreter in Haskell, because I wanted to learn parser combinators

Topics

Resources

Stars

Watchers

Forks