Skip to content

djjolicoeur/yafl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

YAFL Yet Another Fu...Functional, lets go with Functional Langauge.

My humble implementaion of Build your Own Lisp, which doubly piqued my interest as I have been meaning to brush up on my C and I'm a big fan of Lisps.

Build insstructions.

I believe I have a little work to do to get this running across all platforms, but on a mac you can build the project with the included makefile by running make. This should drop the executable in the bin dir, and can be run with ./bin/yafl. Run with no args, this will start the yafl REPL. Run with a file, or files, as command line arg(s), it will exexecute the contents.

UPDATE -- I have added a dependecy on clib for pulling in uthash. you can add uthash by running clib install troydhanson/uthash

Also, you will need to instal the MPC parsing library manually as I have removed the source from the repo. The make file expects it in /src/deps.

Examples

At the moment, only String and longs are supported. here is some example usage from the repl.

➜  yafl git:(master) ✗ ./bin/yafl
yafl Version 0.0.1
Press CTRL+C to Exit

yafl> (print "the basics")
"the basics"
()
yafl> (+ 1 2)
3
yafl> (> 2 1)
1
yafl> true
1
yafl> false
0
yafl> nil
[]
yafl> (< 2 1)
0
yafl> (head [1 2 3])
{1}
yafl> (eval (head [1 2 3]))
1
yafl> (def [l] [1 2 3])
()
yafl> l
[1 2 3]
yafl> (first l)
1
yafl> (defn [plus x y] [+ x y])
()
yafl> (plus 3 4)
7
yafl> (def {a} 1)
()
yafl> a
1
yafl> (def [boring-func] (\ [in] [print "This is all I do" in]))
()
yafl> (boring-func "for now")
"This is all I do" "for now"
()
yafl> (load "../yafl-hello.yfl")
"hello from a file!!!"
()
yafl>

About

Lisp Tutorial / impementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages