Documentation ¶
Index ¶
- func EvalSource(source string) ([]string, error)
- func EvalSourceIO(source string, env *Env) error
- type Env
- type FunctionThunkValue
- type FunctionValue
- type Lexer
- type LispyUserFunction
- type Sexp
- type SexpArray
- type SexpFloat
- type SexpFunctionCall
- type SexpFunctionLiteral
- type SexpInt
- type SexpPair
- type SexpSymbol
- type StackFrame
- type Token
- type TokenType
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalSource ¶
method which exposes eval to other packages which call this as an API to get a result
func EvalSourceIO ¶
used to load library packages into the env
Types ¶
type FunctionThunkValue ¶
type FunctionThunkValue struct {
// contains filtered or unexported fields
}
func (FunctionThunkValue) Eval ¶
func (thunk FunctionThunkValue) Eval(env *Env, frame *StackFrame, allowThunk bool) Sexp
not ideal
func (FunctionThunkValue) String ¶
func (thunk FunctionThunkValue) String() string
type FunctionValue ¶
type FunctionValue struct {
// contains filtered or unexported fields
}
Value referencing any functions
func (FunctionValue) Eval ¶
func (funcVal FunctionValue) Eval(env *Env, frame *StackFrame, allowThunk bool) Sexp
create new function binding
func (FunctionValue) String ¶
func (f FunctionValue) String() string
type Sexp ¶
type Sexp interface { String() string Eval(*Env, *StackFrame, bool) Sexp }
Generic interface for an Sexp (any node in our AST must implement this interface)
type SexpArray ¶
type SexpArray struct {
// contains filtered or unexported fields
}
type SexpFunctionCall ¶
type SexpFunctionCall struct {
// contains filtered or unexported fields
}
func (SexpFunctionCall) Eval ¶
func (s SexpFunctionCall) Eval(env *Env, frame *StackFrame, allowThunk bool) Sexp
func (SexpFunctionCall) String ¶
func (f SexpFunctionCall) String() string
type SexpFunctionLiteral ¶
type SexpFunctionLiteral struct {
// contains filtered or unexported fields
}
SexpFunction Literal to store the functions when parsing them
func (SexpFunctionLiteral) Eval ¶
func (s SexpFunctionLiteral) Eval(env *Env, frame *StackFrame, allowThunk bool) Sexp
func (SexpFunctionLiteral) String ¶
func (f SexpFunctionLiteral) String() string
type SexpPair ¶
type SexpPair struct {
// contains filtered or unexported fields
}
SexpPair is an implementation of a cons cell with a head (car) and tail (cdr) Lists in lispy are defined as linked lists of cons cells
type SexpSymbol ¶
type SexpSymbol struct {
// contains filtered or unexported fields
}
Symbol have dedicated types for strings and bools or this suffices?
func (SexpSymbol) Eval ¶
func (s SexpSymbol) Eval(env *Env, frame *StackFrame, allowThunk bool) Sexp
func (SexpSymbol) String ¶
func (s SexpSymbol) String() string
type StackFrame ¶
type StackFrame struct {
// contains filtered or unexported fields
}
struct to store function arguments for now
type TokenType ¶
type TokenType string
Token type definitions
const ARRAY TokenType = "ARRAY"
const COMMENT TokenType = "COMMENT"
const DEFINE TokenType = "DEFINE"
const DO TokenType = "DO"
const EOF TokenType = "EOF"
not used const ATOM TokenType = "ATOM" const EXP TokenType = "EXP" const ENV TokenType = "ENV"
const FALSE TokenType = "FALSE"
const FLOAT TokenType = "FLOAT"
const ID TokenType = "ID"
const IF TokenType = "IF"
const INTEGER TokenType = "INTEGER"
const LPAREN TokenType = "LPAREN"
const LSQUARE TokenType = "LSQUARE"
const MACRO TokenType = "MACRO"
const QUOTE TokenType = "QUOTE"
const RPAREN TokenType = "RPAREN"
const RSQUARE TokenType = "RSQUARE"
const STRING TokenType = "STRING"
Symbols
const SYMBOL TokenType = "SYMBOL"
const TRUE TokenType = "TRUE"
const UNQUOTE TokenType = "UNQUOTE"