Skip to content

MatheusRich/lana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lana lang

A LISP built in Rust. I followed Stepan Parunashvili's RISP tutorial, but borrowed a few concepts from Clojure.

Features

Improved REPL

Lana's REPL is a bit more powerful than RISP's. It has:

Input provided by ReadLine

You can edit, undo, delete, search, etc. It has a colored output, and the last evaluated expression is available in the alias _:

lana-repl-gif

Macros (coming soon)

Syntax

nil

Lana has a null value called nil.

(nil? nil)
;; => true

(some? nil)
;; => false

if

Macro for evaluating a conditional. All values are accepted as a condition, false and nil are the only falsey values.

(if true true false)
;; => true

(if 0 true false)
;; => true

(if false true false)
;; => false

(if nil true false)
;; => false

do

Macro for evaluating expressions in order and returns the value of the last one.

(do
  (def x 40)
  (def y 2)
  (+ x y))
;; => 42

defn

Syntax sugar for def + fn.

(defn greet (who) (print "Hello, " who "!\n"))

(greet "Richy")
;; Hello, Richy!

Examples

(defn fib (n)
    (if (<= n 2)
        n
        (+ (fib (- n 1)) (fib (- n 2)))))

(fib 10)
;; => 89

You can see more examples under the examples directory.

About

The Lana programming language - A LISP implemented in Rust influenced by Clojure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages