zygomys is an embeddable scripting language. It is a Lisp, and provides an interpreter and REPL (Read-Eval-Print-Loop; that is, it comes with a command line interactive interface).
zygomys allows you to create a Domain Specific Language to drive your program with minimal fuss and maximum convenience.
It is written in Go and plays easily with Go programs and Go structs, using reflection to instantiate Go structs from the scripted configuration. zygomys borrows certain constructs from Clojure, and others from Go.
Because it speaks JSON and Msgpack fluently, zygomys is ideally suited for driving complex configurations and providing projects with a domain specific language customized to your challenges and driving other code.
The example snippets in the tests/*.zy provide many examples. The full documentation can be found in the Wiki.
The standalone REPL is called simply zygo
. Use make
to install zygo
as go get
will
call it zygomys
by default, and the tooling expects the shorter zygo
for tests, etc.)
- Use
zygo
to configure trees of Go structs, and then run methods on them at natively-compiled speed (since you are calling into Go code). -
emacs/zygo.el
emacs mode - JSON and Msgpack interop: serialization and deserialization.
-
(range key value hash (body))
range loops mirror for-range over a hash in Go. -
(for [(initializer) (test) (advance)] (body))
for-loops match those in C and Go. Both(break)
and(continue)
are available for additional loop control. - Raw bytes type
(raw string)
lets you do zero-copy[]byte
manipulation. - Record definitions
(defmap)
make configuration a breeze. - Files can be recursively sourced with
(req path)
or(source "path-string")
. - Go style raw string literals, using
`backticks`
, can contain newlines and"
double quotes directly. Easy templating. - Easy to extend. See the
repl/random.go
,repl/regexp.go
, andrepl/time.go
files for examples. - Clojure like threading
(-> hash field1: field2:)
and(:field hash)
selection. - Macros for your DSL. Syntax-quote templates work anywhere; inside lists,
[]
arrays and{}
hashes.
- zygomys is a small Go library, easy to integrate and use/extend.
- Float, Int, Char, String, Symbol, List, Array, and Hash datatypes builtin.
- Arithmetic (
+
,-
,*
,/
,mod
,**
) - Shift Operators (
sll
,srl
,sra
) - Bitwise operations (
bit-and
,bit-or
,bit-xor
) - Comparison operations (
<
,>
,<=
,>=
,==
,!=
, andnot=
) - Short-circuit boolean operators (
and
andor
) - Conditionals (
cond
) - Lambdas (
fn
) - Bindings (
def
,defn
, andlet
) - Standalone and embedable REPL.
- Tail-call optimization
- Go API
- Macro System
- An actual working macexpand.
(macexpand your-macro)
makes writing/debugging macros easy. - Syntax quoting -- with caret
^()
instead of backtick. - Channel and goroutine support
- Pre- and Post- function call hooks
See the wiki for lots of details and a full description of the zygomys language..
zygomys is a contraction of Zygogeomys, a genus of pocket gophers. The Michoacan pocket gopher (Zygogeomys trichopus) finds its natural habitat in high-altitude forests.
The term is also descriptive. The stem zygo
comes from the Greek for yoke, indicating a pair or a union of two things, and mys
comes from the Greek for mouse. The union of Go and Lisp in a small cute package, that is zygomys.
Two-clause BSD, see LICENSE file.
Jason E. Aten, Ph.D.
The ancestor dialect, Glisp, was designed and implemented by Howard Mao.
The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher
XKCD https://xkcd.com/297/ licensed under a Creative Commons Attribution-NonCommercial 2.5 License(https://xkcd.com/license.html).