Git Product home page Git Product logo

todalu's Introduction

Todalu

Todalu (Kannada for Lisp), is my attempt to write an interpreter for a lisp like language.

Build

git clone https://github.com/sooriravindra/Todalu.git
mkdir Todalu/build; cd Todalu/build
cmake ..
cmake --build .

Install and run

./todalu # Interactive
./todalu ../testscripts/hello-world.tdl

#Alternatively, copy todalu to $PATH

sudo ln -s /usr/bin/todalu $(readlink -f todalu) # Step 1:  setup todalu
todalu # To run an interactive session
../testscripts/hello-world.tdl # To run a script (Check shebang if it doesn't work)

Sample interaction

$ ./todalu
todalu> (+ 20 22)
=> 42
todalu> (- (* 50 2) (/ 40 2) 30)
=> 50
todalu> (def myvar (+ 1 2 3))
=> 6
todalu> (def is-odd (lambda x (eq? (% x 2) 1)))
=> <lambda=94877095594064>
todalu>
todalu> (if (is-odd myvar) (println "That's odd") (println "All good"))
All good
=> "All good"
todalu> (range 1 6)
=> ( 1 2 3 4 5 )
todalu> (filter is-odd (range 1 11))
=> ( 1 3 5 7 9 )
todalu>
=> (progn (print "Enter a number: ") (+ 4 (read)))
Enter a number: 10
=> 14

Built-ins and support

keywordintepretcompile
+yesyes
-yesyes
*yesyes
/yesyes
eq?yesyes
list?yesyes
int?yesyes
bool?yesyes
dec?yesyes
string?yesyes
>yesyes
prognyesyes
printyespartial
printlnyespartial
quoteyesyes
evalyesno
exityesyes
readstryesno
readyesno
caryesyes
cdryesyes
consyesyes
lambdayesyes
defyesyes
ifyesyes

todalu's People

Contributors

sooriravindra avatar

Stargazers

Mahesh avatar Atul R avatar

Watchers

 avatar

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.