var ( // ErrNameNotFound is returned when a lookup is performed with a // non-bound name. ErrNameNotFound = errors.New("name not bound to a value") // ErrNotCallable is returned when a Call is attempted on a non- // callable value. ErrNotCallable = errors.New("value is not callable") // ErrConversionImpossible is returned when the Value type cannot be // converted to the expected type. ErrConversionImpossible = errors.New("cannot be converted") // ErrInvalidNumberOfArgs is returned when a function call is attempted // with invalid number of arguments. ErrInvalidNumberOfArgs = errors.New("invalid number of arguments") )
Execute reads until EOF or an error from the RuneScanner and executes the read s-expressions in the given scope.
ExecuteExpr executes the expr in the given scope.
ExecuteOne reads runes enough to construct one s-exp and executes the s-exp with given scope.
ExecuteStr is a convenience wrapper for Execute.
CommentExpr is returned to represent a lisp-style comment.
Eval returns the comment string.
Expr represents an expression.
Parse parses till the EOF and returns all s-exprs as a single ModuleExpr. This should be used to build an entire module from a file or string etc.
ParseOne consumes runes from the reader until a single s-expression is extracted. Returns any other errors from reader. This should be used when a continuous parse eval from a stream is necessary (e.g. TCP socket).
ParseStr is a convenience wrapper for Parse.
KeywordExpr represents a keyword literal.
Eval returns the keyword itself.
ListExpr represents a list (i.e., a function call) expression.
Eval evaluates each s-exp in the list and then evaluates the list itself as an s-exp.
MacroFunc represents the signature of the Go macro functions. Functions bound in the scope as MacroFunc will receive un-evaluated list of s-exps and the current scope.
ModuleExpr represents a list of Exprs.
Eval executes each expression in the module and returns the last result.
NumberExpr represents number s-expression.
Eval for a number returns itself.
QuoteExpr implements the quote-literal form.
Eval returns the expression itself without evaluating it.
UnquoteEval unquotes and evaluates the underlying expression.
Scope is responsible for managing bindings.
NewScope initializes a new scope with given parent scope. parent can be nil.
StringExpr represents single and double quoted strings.
Eval returns unquoted version of the STRING token.
SymbolExpr represents a symbol.
Eval returns the symbol name itself.
VectorExpr represents a vector form.
Eval creates a golang slice.
|gen||Package gen provides functions for Go code generation from lisp.|