GithubHelp home page GithubHelp logo

lispy's Introduction

Lispy

A lisp built based on "Build your own Lisp" by Daniel Holden.

Lispy in Action

To see Lispy in action use compileLispy.sh (you will first have change permissions for this file).The executable Lispy will be generated. I've written the Bash script to make use of the cc compiler, if you have gcc you can change the initial cc to gcc to compile.

Arithmetic operations are applied to arguments much like how functions in a regular programming language is applied (i.e. Polish notation is used for arithmetic).

Input> (+ 1 1)
2

There are a few example files provided (those ending with lspy) to run these pass the filename as an argument to the executable.

./Lispy stdlib.lspy

The following function to compute the nth Fibonacci number is provided in the stdlib.lspy file (this is currently the standard library of the language).

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

To use this function simply load the stdlib.lspy file and call the function with a number.

Input> fib 3
2

The syntax for Lispy is almost the same as Common-Lisp (look at the .lspy files to understand the syntax). PLEASE NOTE Lispy is very picky about white-space so make sure to get the spacing right!.

Further steps

I'm planning on using what I've done here to implement a completely new language on my own. As you might've noticed Garbage Collection is currently being worked on.

To be implemented

  • Native Types
  • User Defined Types
  • List Literal
  • Operating System interaction
  • Macros
  • Variable Hashtable
  • Pool Allocation
  • Garbage Collection
  • Tail Call Optimisation
  • Lexical Scoping
  • Static Typing and more....

lispy's People

Contributors

pradcoder avatar

lispy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.