Lua Lisp Language
Fnl is a lisp that compiles to Lua. It aims to be easy to use, expressive, and has almost zero overhead compared to handwritten Lua. It's currently a single file Lua library that can be dragged into any Lua project.
The documentation is currently sparse, but I don't want to commit too many features to documentation that haven't been fully defined. Current and projected features inlclude:
Eventually, I also hope to add optional source maps, either embedded in the comments of the generated code, or in separate files. A standard library also needs to be made.
The fnl.lua module exports the following functions:
fnl.repl()- Starts a simple REPL.
fnl.eval(str, options)- Evaluates a string of Fnl.
fnl.compile(str, options)- Compiles a string of Fnl into a string of Lua
fnl.parse(str)- Reads a string and returns an AST.
fnl.compileAst(ast)- Compiles an AST into a Lua string.
(print "hello, world!")
(set fib (fn [n] (or (and (> n 1) (+ (fib (- n 1)) (fib (- n 2)))) 1))) (print (fib 10))
Clone the repository, and run
lua fnl --repl to quickly start a repl.
You can install the dev package from luarocks via
luarocks install --server=http://luarocks.org/dev fnl
Copyright © 2016 Calvin Rose
Released under the MIT licenseОпубликовать в Twitter Опубликовать в Facebook