haltode / lispy

Minimal Lisp-like programming language written in C

Home Page:http://www.buildyourownlisp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lispy

Project from the website Build your own Lisp.

What is Lispy ?

Lispy is a small Lisp-like programming language written in C, using mpc library to parse the input easily.

What are Lispy's features ?

Lispy supports all the basic features that you would expect from a programming language, like :

  • Variables
  • Functions
  • Conditionals
  • Error handling
  • Standard library
  • etc.

But, there is more to it :

  • S-Expression : symbolic-expression is a list of one or more expressions (number, string, symbol, etc.).
  • Q-Expression : quoted-expression is a list of one or more expressions that are not evaluated during process but instead left exactly as they were typed in.

Examples of programs written in Lispy

Hello World! :

("Hello World!")

Fibonacci function :

(fun {fib n} {
  select
    { (== n 0) 0 }
    { (== n 1) 1 }
    { otherwise (+ (fib (- n 1)) (fib (- n 2))) }
})

Factorial function :

(fun {fac n} {
   select
      { (== n 0) 1 }
      { otherwise (* (n) (fac(- n 1)))}
})

About

Minimal Lisp-like programming language written in C

http://www.buildyourownlisp.com/

License:MIT License


Languages

Language:C 99.4%Language:Makefile 0.4%Language:C++ 0.2%