Slurp is a highly customisable, embeddable LISP toolkit for Go
applications.
Slurp is for developers who want to design and embed an interpreted language inside of a Go program.
Slurp provides composable building-blocks that make it easy to design a custom lisp, even if you've never written an interpreter before. Since Slurp is written in pure Go, your new language can be embedded into any Go program by importing it — just like any other library.
NOTE: Slurp is NOT an implementation of a particular LISP dialect.
It provides pieces that can be used to build a LISP dialect or can be used as a scripting layer.
Slurp is designed around three core values:
- Simplicity: The library is small and has few moving parts.
- Batteries Included: There are no external dependencies and little configuration required.
- Go Interoperability: Slurp can call Go code and fully supports Go's concurrency features.
We hope that you will find Slurp to be powerful, useful and fun to use. We look forward to seeing what you build with it!
- Highly customizable, safe and powerful reader/parser through a read table (Inspired by Clojure) (See Reader)
- Immutable datatypes including: nil, bool, string, int & float, character, keyword, symbol, list, vector & map.
- Multiple number formats supported: decimal, octal, hexadecimal, radix and scientific notations.
- Full unicode support. Symbols, keywords etc. can include unicode
characters (Example:
find-δ
,π
etc.) and🧠
,🏃
etc. (yes, smileys too). - Character Literals with support for:
- simple literals (e.g.,
\a
fora
) - special literals (e.g.,
\newline
,\tab
etc.) - unicode literals (e.g.,
\u00A5
for¥
etc.)
- simple literals (e.g.,
- Full interoperability with Go: call native Go functions/libraries, and manipulate native Go datatypes from your language.
- Support for macros.
- Easy to extend. See Wiki.
- Tiny & powerful REPL package.
- Zero dependencies (outside of tests).
Slurp requires Go 1.14 or higher. It can be installed using go get
:
go get -u github.com/spy16/slurp
What can you use it for?
- Embedded script engine to provide dynamic behavior without requiring re-compilation of your application (example).
- Business rule engine exposing specific, composable rules (example).
- To build DSLs.
- To build your own LISP dialect (example).
Refer ./examples for more usage examples.
In addition to the GoDocs, we maintain in-depth tutorials on the GitHub wiki. The following pages are good starting points: