DEPRECATED: This repository is deprecated in favour much better slurp project and will be archived/removed soon.
Parens is a highly customisable, embeddable LISP toolkit.
find-δ
, π
etc.)
and 🧠
, 🏃
etc. (yes, smileys too).\a
for a
)\newline
, \tab
etc.)\u00A5
for ¥
etc.)Please note that Parens 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.
What can you use it for?
Parens requires Go 1.14 or higher.
Parens reader is inspired by Clojure reader and uses a read table. Reader can be extended
to add new syntactical features by adding reader macros to the read table. Reader Macros
are implementations of reader.Macro
function type. All syntax that reader can read are
implemented using Reader Macros. Use SetMacro()
method of reader.Reader
to override or
add a custom reader or dispatch macro.
Reader returned by reader.New(...)
, is configured to support following forms:
int64
Go representation and can be specified using decimal, binary
hexadecimal or radix notations. (e.g., 123, -123, 0b101011, 0xAF, 2r10100, 8r126 etc.)float64
Go representation and can be specified using
decimal notation or scientific notation. (e.g.: 3.1412, -1.234, 1e-5, 2e3, 1.5e3 etc.)WithNumReader()
. rune
or uint8
Go representation and can be written in 3 ways:
\a
, \λ
, \β
etc.\newline
, \tab
etc.\u1267
true
or false
are converted to Bool
type.nil
is represented as a zero-allocation empty struct in Go.:
. (e.g., :foo
)(1 2 3)
, (1 [])
).Parens uses an Env
for evaluating forms. A form is first macro-expanded and then analysed
to produce an Expr
that can be evaluated.
Expander
implementation. See parens.WithExpander()
.Analyzer
implementation. See parens.WithAnalyzer()
.