Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //True defines the general description of boolean true with an integer of data 1 True = Token{Int, int64(1)} //False defines the general description of boolean false with an empty list False = Token{List, []Token(nil)} //None defines a Token with no data None = Token{} //Global is the root of lisp instance list, all system function are recorded in the env map of Global Global = &Lisp{env: map[Name]Token{}, parent: nil} )
var ( ErrNotOver = errors.New("cannot scan to the end") ErrUnquote = errors.New("quote is unfold") ErrNotFind = errors.New("not find this Name") ErrNotFunc = errors.New("not a function") ErrParaNum = errors.New("wrong parament number") ErrFitType = errors.New("lisp type is wrong") ErrNotName = errors.New("this's not a Name") ErrIsEmpty = errors.New("fold is empty") ErrNotConv = errors.New("cannot translate") ErrRefused = errors.New("can't remove a back function") ErrDivZero = errors.New("cannot divide zero") ErrModZero = errors.New("cannot mod zero") )
The followings define all the error strings
Functions ¶
Types ¶
type Kind ¶
type Kind int
Kind is used to be the type of Token's type
The followings define all kinds of Token
type Lisp ¶
type Lisp struct {
// contains filtered or unexported fields
}
Lisp struct describes a scope there is an unique global lisp scope which is the root scope all system functions are recorded in the global scope each running program will create a lisp instance as a child of global lisp each function/macro/block/loop will create a new lisp instance as a child of the program lisp
func (*Lisp) Eval ¶
Eval interprets the raw code completely, including lexical analysis, parsing and executing
type Token ¶
type Token struct { Kind Text interface{} }
Token is an important structure in lisp interpretation Token can describe a lexical unit Token can also describe a node in syntax tree
func Scan ¶
Scan does the lexical analysis input is the raw data of go-lisp code output is result of lexical analysis with an array of token
func Tree ¶
Tree works as a parser input is the result of Scan(lexical analysis) with an array of Token output is an array of root of a syntax tree