Documentation ¶
Index ¶
- Constants
- Variables
- func BuiltinFunctions() map[string]UserFunction
- func Compare(a Sexp, b Sexp) (int, error)
- func DecodeChar(atom string) (string, error)
- func DumpFunction(w io.Writer, fun Function)
- func EscapeChar(char rune) (rune, error)
- func HashCountKeys(hash *SexpHash) (int, error)
- func HashExpression(expr Sexp) (int, error)
- func HashIsEmpty(hash *SexpHash) bool
- func InspectType(expr Sexp) string
- func IsArray(expr Sexp) bool
- func IsBool(expr Sexp) bool
- func IsBytes(expr Sexp) bool
- func IsChar(expr Sexp) bool
- func IsEmpty(expr Sexp) bool
- func IsFloat(expr Sexp) bool
- func IsFunction(expr Sexp) bool
- func IsHash(expr Sexp) bool
- func IsIType(s Sexp) bool
- func IsInt(expr Sexp) bool
- func IsList(expr Sexp) bool
- func IsNumber(expr Sexp) bool
- func IsString(expr Sexp) bool
- func IsSymbol(expr Sexp) bool
- func IsTruthy(expr Sexp) bool
- func IsZero(expr Sexp) bool
- func Marshal(a Sexp) ([]byte, error)
- func ParseDoc(docstr string) map[string]string
- func QueryBuiltinDoc(funcName string) string
- func StringToRunes(str string) []rune
- func WrongGeneratorNumberArguments(funcname string, current int, expect ...int) error
- type AddScopeInstr
- type Address
- type BindDynFunInstr
- type BindlistInstr
- type BranchInstr
- type CallInstr
- type Clonable
- type Comparable
- type DataStackElem
- type DispatchInstr
- type DupInstr
- type Environment
- func (env *Environment) AddFunction(name string, function UserFunction, opts ...FuntionOption)
- func (env *Environment) AddFuzzyMacro(name string, function UserFunction, opts ...FuntionOption)
- func (env *Environment) AddMacro(name string, function UserFunction, opts ...FuntionOption)
- func (env *Environment) AddNamedFunction(name string, function NamedUserFunction, opts ...FuntionOption)
- func (env *Environment) Apply(fun *SexpFunction, args []Sexp) (Sexp, error)
- func (env *Environment) ApplyByName(fun string, args []Sexp) (Sexp, error)
- func (env *Environment) Bind(name string, expr Sexp) error
- func (env *Environment) BindGlobal(name string, expr Sexp) error
- func (env *Environment) CallFunction(function *SexpFunction, nargs int) error
- func (env *Environment) CallUserFunction(function *SexpFunction, name string, nargs int) error
- func (env *Environment) Clear()
- func (env *Environment) Clone() *Environment
- func (env *Environment) CurrentFunctionSize() int
- func (env *Environment) DumpEnvironment(w io.Writer)
- func (env *Environment) DumpFunctionByName(w io.Writer, name string) error
- func (env *Environment) Duplicate() *Environment
- func (env *Environment) EvalString(str string) (Sexp, error)
- func (env *Environment) FindMacro(name string) (*SexpFunction, bool)
- func (env *Environment) FindObject(name string) (Sexp, bool)
- func (env *Environment) GenSymbol(optionalPrefix ...string) SexpSymbol
- func (env *Environment) GetStackTrace(err error) string
- func (env *Environment) GlobalFunctions() []string
- func (env *Environment) ImportEval() error
- func (env *Environment) LoadExpressions(expressions []Sexp) error
- func (env *Environment) LoadFile(file *os.File) error
- func (env *Environment) LoadStream(stream io.Reader) error
- func (env *Environment) LoadString(str string) error
- func (env *Environment) MakeScriptFunction(script string) (*SexpFunction, error)
- func (env *Environment) MakeSymbol(name string) SexpSymbol
- func (env *Environment) OverrideFunction(name string, f OverrideFunction, opts ...FuntionOption) error
- func (env *Environment) ParseFile(file string) ([]Sexp, error)
- func (env *Environment) ParseStream(in io.Reader) ([]Sexp, error)
- func (env *Environment) PopGlobalScope() error
- func (env *Environment) PushGlobalScope() error
- func (env *Environment) ReachedEnd() bool
- func (env *Environment) ReturnFromFunction() error
- func (env *Environment) Run() (Sexp, error)
- func (env *Environment) SetFileReader(fr FileReader)
- func (env *Environment) SourceExpressions(expressions []Sexp) error
- func (env *Environment) SourceStream(stream io.Reader) error
- type ExplodeInstr
- type FileReader
- type FuncMap
- type Function
- type FuntionOption
- type Generator
- func (gen *Generator) AddInstruction(instr Instruction)
- func (gen *Generator) AddInstructions(instr []Instruction)
- func (gen *Generator) Generate(expr Sexp) error
- func (gen *Generator) GenerateAll(expressions []Sexp) error
- func (gen *Generator) GenerateArray(arr SexpArray) error
- func (gen *Generator) GenerateAssert(args []Sexp) error
- func (gen *Generator) GenerateBegin(expressions []Sexp) error
- func (gen *Generator) GenerateCall(expr *SexpPair) error
- func (gen *Generator) GenerateCallBySymbol(sym SexpSymbol, args []Sexp) error
- func (gen *Generator) GenerateCond(args []Sexp) error
- func (gen *Generator) GenerateDef(args []Sexp, isSet bool) error
- func (gen *Generator) GenerateDefmac(args []Sexp) error
- func (gen *Generator) GenerateDefn(args []Sexp) error
- func (gen *Generator) GenerateDispatch(fun Sexp, args []Sexp) error
- func (gen *Generator) GenerateFn(args []Sexp) error
- func (gen *Generator) GenerateInclude(args []Sexp) error
- func (gen *Generator) GenerateLet(name string, args []Sexp) error
- func (gen *Generator) GenerateMacexpand(args []Sexp) error
- func (gen *Generator) GenerateQuote(args []Sexp) error
- func (gen *Generator) GenerateSharpQuote(args []Sexp) error
- func (gen *Generator) GenerateShortCircuit(or bool, args []Sexp) error
- func (gen *Generator) GenerateSyntaxQuote(args []Sexp) error
- func (gen *Generator) Reset()
- type GetInstr
- type GotoInstr
- type HashizeInstr
- type ITypeName
- type Instruction
- type JumpInstr
- type Lexer
- type LexerState
- type ListBuilder
- type Loop
- type NamedUserFunction
- type OverrideFunction
- type Parser
- type PopInstr
- type PrepareCallInstr
- type PushInstr
- type PushInstrClosure
- type PutInstr
- type RefSymInstr
- type RemoveScopeInstr
- type ReturnInstr
- type RuneReader
- type Scope
- type ScopeElem
- type Sexp
- func ConcatHash(h *SexpHash, b ...Sexp) (Sexp, error)
- func ConcatList(a *SexpPair, b ...Sexp) (Sexp, error)
- func FilterList(env *Environment, fun *SexpFunction, list *SexpPair) (Sexp, error)
- func FlatMapHash(env *Environment, fun *SexpFunction, arr *SexpHash) (Sexp, error)
- func FlatMapList(env *Environment, fun *SexpFunction, expr Sexp) (Sexp, error)
- func FoldlArray(env *Environment, fun *SexpFunction, lst Sexp, acc Sexp) (Sexp, error)
- func FoldlHash(env *Environment, fun *SexpFunction, hash *SexpHash, acc Sexp) (Sexp, error)
- func FoldlList(env *Environment, fun *SexpFunction, lst, acc Sexp) (Sexp, error)
- func ListToArray(expr Sexp) ([]Sexp, error)
- func MakeList(expressions []Sexp) Sexp
- func MapHash(env *Environment, fun *SexpFunction, arr *SexpHash) (Sexp, error)
- func MapList(env *Environment, fun *SexpFunction, expr Sexp) (Sexp, error)
- func ParseArray(parser *Parser) (Sexp, error)
- func ParseExpression(parser *Parser) (Sexp, error)
- func ParseHash(parser *Parser) (Sexp, error)
- func ParseList(parser *Parser) (Sexp, error)
- func ParseTokens(env *Environment, lexer *Lexer) ([]Sexp, error)
- func WrongNumberArguments(funcname string, current int, expect ...int) (Sexp, error)
- type SexpArray
- func ConcatArray(arr SexpArray, exprs ...Sexp) (SexpArray, error)
- func FilterArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
- func FlatMapArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
- func MapArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
- type SexpBool
- type SexpBytes
- type SexpChar
- type SexpFloat
- func (f SexpFloat) Add(f2 SexpFloat) SexpFloat
- func (f SexpFloat) Ceil() SexpInt
- func (f SexpFloat) Cmp(f2 SexpFloat) int
- func (f SexpFloat) Div(f2 SexpFloat) SexpFloat
- func (f SexpFloat) Floor() SexpInt
- func (f SexpFloat) Format(s string) string
- func (a SexpFloat) MarshalJSON() ([]byte, error)
- func (f SexpFloat) Mul(f2 SexpFloat) SexpFloat
- func (f SexpFloat) Round() SexpInt
- func (f SexpFloat) SexpString() string
- func (f SexpFloat) Sub(f2 SexpFloat) SexpFloat
- func (f SexpFloat) ToFloat64() float64
- func (f SexpFloat) ToString(prec int) string
- type SexpFunction
- type SexpHash
- func (hash *SexpHash) Explain(env *Environment, field string, args []Sexp) (Sexp, error)
- func (hash *SexpHash) Foreach(fn func(Sexp, Sexp) bool)
- func (hash *SexpHash) HashDelete(key Sexp) error
- func (hash *SexpHash) HashExist(key Sexp) bool
- func (hash *SexpHash) HashGet(key Sexp) (Sexp, error)
- func (hash *SexpHash) HashGetDefault(key Sexp, defaultval Sexp) (Sexp, error)
- func (hash *SexpHash) HashSet(key Sexp, val Sexp) error
- func (a *SexpHash) MarshalJSON() ([]byte, error)
- func (hash *SexpHash) SexpString() string
- type SexpInt
- func (i SexpInt) Add(j SexpInt) SexpInt
- func (i SexpInt) And(j SexpInt) SexpInt
- func (i SexpInt) BitNot() SexpInt
- func (i SexpInt) Div(j SexpInt) SexpInt
- func (i SexpInt) Format(s string) string
- func (i SexpInt) IsInt64() bool
- func (i SexpInt) IsUint64() bool
- func (i SexpInt) IsZero() bool
- func (a SexpInt) MarshalJSON() ([]byte, error)
- func (i SexpInt) Mod(j SexpInt) SexpInt
- func (i SexpInt) Mul(j SexpInt) SexpInt
- func (i SexpInt) Or(j SexpInt) SexpInt
- func (i SexpInt) Random(rnd *rand.Rand) SexpInt
- func (i SexpInt) SexpString() string
- func (i SexpInt) ShiftLeft(j SexpInt) SexpInt
- func (i SexpInt) ShiftRight(j SexpInt) SexpInt
- func (i SexpInt) Sign() int
- func (i SexpInt) Sub(j SexpInt) SexpInt
- func (i SexpInt) ToInt() int
- func (i SexpInt) ToInt64() int64
- func (i SexpInt) ToUint64() uint64
- func (i SexpInt) Xor(j SexpInt) SexpInt
- type SexpPair
- type SexpSentinel
- type SexpStr
- type SexpSymbol
- type SquashInstr
- type Stack
- func (stack *Stack) BindSymbol(sym SexpSymbol, expr Sexp) error
- func (stack *Stack) Clone() *Stack
- func (stack *Stack) Get(n int) (StackElem, error)
- func (stack *Stack) GetExpr(n int) (Sexp, error)
- func (stack *Stack) GetExpressions(n int) ([]Sexp, error)
- func (stack *Stack) IsEmpty() bool
- func (stack *Stack) IsStackElem()
- func (stack *Stack) LookupSymbol(sym SexpSymbol) (Sexp, error)
- func (stack *Stack) Pop() (StackElem, error)
- func (stack *Stack) PopAddr() (*SexpFunction, int, error)
- func (stack *Stack) PopExpr() (Sexp, error)
- func (stack *Stack) PopExpressions(n int) ([]Sexp, error)
- func (stack *Stack) PopScope() error
- func (stack *Stack) PrintStack(w io.Writer)
- func (stack *Stack) Push(elem StackElem)
- func (stack *Stack) PushAddr(function *SexpFunction, pc int)
- func (stack *Stack) PushAllTo(target *Stack) int
- func (stack *Stack) PushExpr(expr Sexp)
- func (stack *Stack) PushMulti(elems ...StackElem)
- func (stack *Stack) PushScope()
- func (stack *Stack) SetSymbol(sym SexpSymbol, expr Sexp) error
- func (stack *Stack) Top() int
- type StackElem
- type Stringer
- type Token
- type TokenType
- type UserFunction
- func GetAnyToBool(name string) UserFunction
- func GetAnyToBytes(name string) UserFunction
- func GetAnyToChar(name string) UserFunction
- func GetAnyToFloat(name string) UserFunction
- func GetAnyToInteger(name string) UserFunction
- func GetAnyToSymbolFunction(name string) UserFunction
- func GetAppendFunction(name string) UserFunction
- func GetApplyFunction(name string) UserFunction
- func GetArrayAccessFunction(name string) UserFunction
- func GetConcatFunction(name string) UserFunction
- func GetConsFunction(name string) UserFunction
- func GetConstructorFunction(name string) UserFunction
- func GetEvalFunction(name string) UserFunction
- func GetExistFunction(name string) UserFunction
- func GetFirstFunction(name string) UserFunction
- func GetGenSymFunction(name string) UserFunction
- func GetHashAccessFunction(name string) UserFunction
- func GetLenFunction(name string) UserFunction
- func GetMakeArrayFunction(name string) UserFunction
- func GetNotFunction(name string) UserFunction
- func GetReadFunction(name string) UserFunction
- func GetRestFunction(name string) UserFunction
- func GetSexpString(name string) UserFunction
- func GetSgetFunction(name string) UserFunction
- func GetSliceFunction(name string) UserFunction
- func GetSourceFileFunction(name string) UserFunction
- func GetStringifyFunction(name string) UserFunction
- func GetSymnumFunction(name string) UserFunction
- func GetTypeFunction(name string) UserFunction
- func GetTypeQueryFunction(name string) UserFunction
- type VectorizeInstr
- type Zerable
Constants ¶
View Source
const CallStackSize = 25
View Source
const DataStackSize = 100
View Source
const Many = -1
View Source
const ScopeStackSize = 50
View Source
const SliceDefaultCap = 10
View Source
const StackStackSize = 5
Variables ¶
View Source
var ( BoolRegex = regexp.MustCompile("^(true|false)$") DecimalRegex = regexp.MustCompile("^-?[0-9]+$") HexRegex = regexp.MustCompile("^0x[0-9a-fA-F]+$") OctRegex = regexp.MustCompile("^0o[0-7]+$") BinaryRegex = regexp.MustCompile("^0b[01]+$") BinaryStreamRegex = regexp.MustCompile("^0B[0-9a-z]+$") SymbolRegex = regexp.MustCompile("^[^'#]+$") CharRegex = regexp.MustCompile("^#\\\\?.$") FloatRegex = regexp.MustCompile("^-?([0-9]+\\.[0-9]*)|(\\.[0-9]+)|([0-9]+(\\.[0-9]*)?[eE](-?[0-9]+))$") )
View Source
var Float64EqualityThreshold = 1e-10
View Source
var MissingFunction = &SexpFunction{ name: "__missing", user: true, nargs: 0, varargs: false, fun: nil, }
View Source
var OutOfBounds error = errors.New("jump out of bounds")
View Source
var UnexpectedEnd error = errors.New("Unexpected end of input")
View Source
var WrongType error = errors.New("operands have invalid type")
Functions ¶
func BuiltinFunctions ¶
func BuiltinFunctions() map[string]UserFunction
func DecodeChar ¶
func DumpFunction ¶
func EscapeChar ¶
func HashCountKeys ¶
func HashExpression ¶
func HashIsEmpty ¶
func InspectType ¶
func IsFunction ¶
func QueryBuiltinDoc ¶
func StringToRunes ¶
Types ¶
type AddScopeInstr ¶
type AddScopeInstr int
func (AddScopeInstr) Execute ¶
func (a AddScopeInstr) Execute(env *Environment) error
func (AddScopeInstr) InstrString ¶
func (a AddScopeInstr) InstrString() string
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func (Address) IsStackElem ¶
func (a Address) IsStackElem()
type BindDynFunInstr ¶
type BindDynFunInstr struct {
// contains filtered or unexported fields
}
func (BindDynFunInstr) Execute ¶
func (p BindDynFunInstr) Execute(env *Environment) error
func (BindDynFunInstr) InstrString ¶
func (p BindDynFunInstr) InstrString() string
type BindlistInstr ¶
type BindlistInstr struct{}
func (BindlistInstr) Execute ¶
func (b BindlistInstr) Execute(env *Environment) error
func (BindlistInstr) InstrString ¶
func (b BindlistInstr) InstrString() string
type BranchInstr ¶
type BranchInstr struct {
// contains filtered or unexported fields
}
func (BranchInstr) Execute ¶
func (b BranchInstr) Execute(env *Environment) error
func (BranchInstr) InstrString ¶
func (b BranchInstr) InstrString() string
type CallInstr ¶
type CallInstr struct {
// contains filtered or unexported fields
}
func (CallInstr) Execute ¶
func (c CallInstr) Execute(env *Environment) error
func (CallInstr) InstrString ¶
type Comparable ¶
type Comparable interface { Sexp // Cmp compares x and y and returns: // // -1 if x < y // 0 if x == y // +1 if x > y // Cmp(Comparable) (int, error) }
type DataStackElem ¶
type DataStackElem struct {
// contains filtered or unexported fields
}
func (*DataStackElem) IsStackElem ¶
func (d *DataStackElem) IsStackElem()
type DispatchInstr ¶
type DispatchInstr struct {
// contains filtered or unexported fields
}
func (DispatchInstr) Execute ¶
func (d DispatchInstr) Execute(env *Environment) error
func (DispatchInstr) InstrString ¶
func (d DispatchInstr) InstrString() string
type DupInstr ¶
type DupInstr int
func (DupInstr) Execute ¶
func (d DupInstr) Execute(env *Environment) error
func (DupInstr) InstrString ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Environment
func (*Environment) AddFunction ¶
func (env *Environment) AddFunction(name string, function UserFunction, opts ...FuntionOption)
func (*Environment) AddFuzzyMacro ¶
func (env *Environment) AddFuzzyMacro(name string, function UserFunction, opts ...FuntionOption)
func (*Environment) AddMacro ¶
func (env *Environment) AddMacro(name string, function UserFunction, opts ...FuntionOption)
func (*Environment) AddNamedFunction ¶
func (env *Environment) AddNamedFunction(name string, function NamedUserFunction, opts ...FuntionOption)
func (*Environment) Apply ¶
func (env *Environment) Apply(fun *SexpFunction, args []Sexp) (Sexp, error)
func (*Environment) ApplyByName ¶
func (env *Environment) ApplyByName(fun string, args []Sexp) (Sexp, error)
func (*Environment) BindGlobal ¶
func (env *Environment) BindGlobal(name string, expr Sexp) error
func (*Environment) CallFunction ¶
func (env *Environment) CallFunction(function *SexpFunction, nargs int) error
func (*Environment) CallUserFunction ¶
func (env *Environment) CallUserFunction(function *SexpFunction, name string, nargs int) error
func (*Environment) Clear ¶
func (env *Environment) Clear()
func (*Environment) Clone ¶
func (env *Environment) Clone() *Environment
func (*Environment) CurrentFunctionSize ¶
func (env *Environment) CurrentFunctionSize() int
func (*Environment) DumpEnvironment ¶
func (env *Environment) DumpEnvironment(w io.Writer)
func (*Environment) DumpFunctionByName ¶
func (env *Environment) DumpFunctionByName(w io.Writer, name string) error
func (*Environment) Duplicate ¶
func (env *Environment) Duplicate() *Environment
func (*Environment) EvalString ¶
func (env *Environment) EvalString(str string) (Sexp, error)
func (*Environment) FindMacro ¶
func (env *Environment) FindMacro(name string) (*SexpFunction, bool)
func (*Environment) FindObject ¶
func (env *Environment) FindObject(name string) (Sexp, bool)
func (*Environment) GenSymbol ¶
func (env *Environment) GenSymbol(optionalPrefix ...string) SexpSymbol
func (*Environment) GetStackTrace ¶
func (env *Environment) GetStackTrace(err error) string
func (*Environment) GlobalFunctions ¶
func (env *Environment) GlobalFunctions() []string
func (*Environment) ImportEval ¶
func (env *Environment) ImportEval() error
func (*Environment) LoadExpressions ¶
func (env *Environment) LoadExpressions(expressions []Sexp) error
func (*Environment) LoadStream ¶
func (env *Environment) LoadStream(stream io.Reader) error
LoadStream, load this in via running a __main function and setting main on the environment
func (*Environment) LoadString ¶
func (env *Environment) LoadString(str string) error
func (*Environment) MakeScriptFunction ¶
func (env *Environment) MakeScriptFunction(script string) (*SexpFunction, error)
func (*Environment) MakeSymbol ¶
func (env *Environment) MakeSymbol(name string) SexpSymbol
func (*Environment) OverrideFunction ¶
func (env *Environment) OverrideFunction(name string, f OverrideFunction, opts ...FuntionOption) error
func (*Environment) ParseFile ¶
func (env *Environment) ParseFile(file string) ([]Sexp, error)
ParseFile, used in the generator at read time to dynamiclly add more defs from other files
func (*Environment) ParseStream ¶
func (env *Environment) ParseStream(in io.Reader) ([]Sexp, error)
func (*Environment) PopGlobalScope ¶
func (env *Environment) PopGlobalScope() error
func (*Environment) PushGlobalScope ¶
func (env *Environment) PushGlobalScope() error
func (*Environment) ReachedEnd ¶
func (env *Environment) ReachedEnd() bool
func (*Environment) ReturnFromFunction ¶
func (env *Environment) ReturnFromFunction() error
func (*Environment) Run ¶
func (env *Environment) Run() (Sexp, error)
func (*Environment) SetFileReader ¶
func (env *Environment) SetFileReader(fr FileReader)
func (*Environment) SourceExpressions ¶
func (env *Environment) SourceExpressions(expressions []Sexp) error
func (*Environment) SourceStream ¶
func (env *Environment) SourceStream(stream io.Reader) error
SourceStream, load this in via a __source dynamic function, after it runs it no longer exists
type ExplodeInstr ¶
type ExplodeInstr int
func (ExplodeInstr) Execute ¶
func (e ExplodeInstr) Execute(env *Environment) error
func (ExplodeInstr) InstrString ¶
func (e ExplodeInstr) InstrString() string
type FileReader ¶
type FileReader interface {
Open(file string) (io.ReadCloser, error)
}
func DefaultFileReader ¶
func DefaultFileReader() FileReader
type FuncMap ¶
type FuncMap struct {
// contains filtered or unexported fields
}
func NewFuncMap ¶
func NewFuncMap() *FuncMap
func (*FuncMap) Add ¶
func (fm *FuncMap) Add(sym SexpSymbol, f *SexpFunction)
func (*FuncMap) Find ¶
func (fm *FuncMap) Find(sym SexpSymbol) (*SexpFunction, bool)
type Function ¶
type Function []Instruction
type FuntionOption ¶
type FuntionOption func(*SexpFunction)
func WithDoc ¶
func WithDoc(doc string) FuntionOption
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func NewGenerator(env *Environment) *Generator
func (*Generator) AddInstruction ¶
func (gen *Generator) AddInstruction(instr Instruction)
func (*Generator) AddInstructions ¶
func (gen *Generator) AddInstructions(instr []Instruction)
func (*Generator) GenerateAll ¶
func (*Generator) GenerateArray ¶
func (*Generator) GenerateAssert ¶
func (*Generator) GenerateBegin ¶
func (*Generator) GenerateCall ¶
func (*Generator) GenerateCallBySymbol ¶
func (gen *Generator) GenerateCallBySymbol(sym SexpSymbol, args []Sexp) error
func (*Generator) GenerateCond ¶
func (*Generator) GenerateDefmac ¶
func (*Generator) GenerateDefn ¶
func (*Generator) GenerateDispatch ¶
func (*Generator) GenerateFn ¶
func (*Generator) GenerateInclude ¶
func (*Generator) GenerateMacexpand ¶
func (*Generator) GenerateQuote ¶
func (*Generator) GenerateSharpQuote ¶
func (*Generator) GenerateShortCircuit ¶
func (*Generator) GenerateSyntaxQuote ¶
side-effect (or main effect) has to be pushing an expression on the top of the datastack that represents the expanded and substituted expression
type GetInstr ¶
type GetInstr struct {
// contains filtered or unexported fields
}
func (GetInstr) Execute ¶
func (g GetInstr) Execute(env *Environment) error
func (GetInstr) InstrString ¶
type GotoInstr ¶
type GotoInstr struct {
// contains filtered or unexported fields
}
func (GotoInstr) Execute ¶
func (g GotoInstr) Execute(env *Environment) error
func (GotoInstr) InstrString ¶
type HashizeInstr ¶
type HashizeInstr struct {
HashLen int
}
func (HashizeInstr) Execute ¶
func (s HashizeInstr) Execute(env *Environment) error
func (HashizeInstr) InstrString ¶
func (s HashizeInstr) InstrString() string
type Instruction ¶
type Instruction interface { InstrString() string Execute(env *Environment) error }
type JumpInstr ¶
type JumpInstr struct {
// contains filtered or unexported fields
}
func (JumpInstr) Execute ¶
func (j JumpInstr) Execute(env *Environment) error
func (JumpInstr) InstrString ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func NewLexerFromStream ¶
func NewLexerFromStream(stream io.RuneReader) *Lexer
func (*Lexer) GetNextToken ¶
func (*Lexer) LexNextRune ¶
func (*Lexer) LineOffset ¶
func (*Lexer) PeekNextToken ¶
type LexerState ¶
type LexerState int
const ( LexerNormal LexerState = iota LexerComment LexerStrLit LexerRawStrLit LexerStrEscaped LexerUnquote LexerSharp )
type ListBuilder ¶
type ListBuilder struct {
// contains filtered or unexported fields
}
func NewListBuilder ¶
func NewListBuilder() *ListBuilder
func (*ListBuilder) Add ¶
func (b *ListBuilder) Add(exprs ...Sexp) *ListBuilder
func (*ListBuilder) Get ¶
func (b *ListBuilder) Get() Sexp
func (*ListBuilder) Size ¶
func (b *ListBuilder) Size() int
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
func (*Loop) IsStackElem ¶
func (loop *Loop) IsStackElem()
type NamedUserFunction ¶
type NamedUserFunction func(string) UserFunction
type OverrideFunction ¶
type OverrideFunction func(*SexpFunction) UserFunction
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(l *Lexer, e *Environment) *Parser
type PopInstr ¶
type PopInstr int
func (PopInstr) Execute ¶
func (p PopInstr) Execute(env *Environment) error
func (PopInstr) InstrString ¶
type PrepareCallInstr ¶
type PrepareCallInstr struct {
// contains filtered or unexported fields
}
func (PrepareCallInstr) Execute ¶
func (c PrepareCallInstr) Execute(env *Environment) error
func (PrepareCallInstr) InstrString ¶
func (c PrepareCallInstr) InstrString() string
type PushInstr ¶
type PushInstr struct {
// contains filtered or unexported fields
}
func (PushInstr) Execute ¶
func (p PushInstr) Execute(env *Environment) error
func (PushInstr) InstrString ¶
type PushInstrClosure ¶
type PushInstrClosure struct {
// contains filtered or unexported fields
}
func (PushInstrClosure) Execute ¶
func (p PushInstrClosure) Execute(env *Environment) error
func (PushInstrClosure) InstrString ¶
func (p PushInstrClosure) InstrString() string
type PutInstr ¶
type PutInstr struct {
// contains filtered or unexported fields
}
func (PutInstr) Execute ¶
func (p PutInstr) Execute(env *Environment) error
func (PutInstr) InstrString ¶
type RefSymInstr ¶
type RefSymInstr struct { }
func (RefSymInstr) Execute ¶
func (p RefSymInstr) Execute(env *Environment) error
func (RefSymInstr) InstrString ¶
func (p RefSymInstr) InstrString() string
type RemoveScopeInstr ¶
type RemoveScopeInstr int
func (RemoveScopeInstr) Execute ¶
func (a RemoveScopeInstr) Execute(env *Environment) error
func (RemoveScopeInstr) InstrString ¶
func (a RemoveScopeInstr) InstrString() string
type ReturnInstr ¶
type ReturnInstr struct {
// contains filtered or unexported fields
}
func (ReturnInstr) Execute ¶
func (r ReturnInstr) Execute(env *Environment) error
func (ReturnInstr) InstrString ¶
func (r ReturnInstr) InstrString() string
type RuneReader ¶
type RuneReader interface { Offset() (line int, offset int) CurLine() string ReadRune() (r rune, size int, err error) }
func NewRuneReader ¶
func NewRuneReader(r io.RuneReader) RuneReader
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
func (*Scope) IsStackElem ¶
func (s *Scope) IsStackElem()
type Sexp ¶
type Sexp interface {
SexpString() string
}
func FilterList ¶
func FilterList(env *Environment, fun *SexpFunction, list *SexpPair) (Sexp, error)
func FlatMapHash ¶
func FlatMapHash(env *Environment, fun *SexpFunction, arr *SexpHash) (Sexp, error)
func FlatMapList ¶
func FlatMapList(env *Environment, fun *SexpFunction, expr Sexp) (Sexp, error)
func FoldlArray ¶
func FoldlArray(env *Environment, fun *SexpFunction, lst Sexp, acc Sexp) (Sexp, error)
func FoldlHash ¶
func FoldlHash(env *Environment, fun *SexpFunction, hash *SexpHash, acc Sexp) (Sexp, error)
func FoldlList ¶
func FoldlList(env *Environment, fun *SexpFunction, lst, acc Sexp) (Sexp, error)
func ListToArray ¶
func MapHash ¶
func MapHash(env *Environment, fun *SexpFunction, arr *SexpHash) (Sexp, error)
func MapList ¶
func MapList(env *Environment, fun *SexpFunction, expr Sexp) (Sexp, error)
func ParseArray ¶
func ParseExpression ¶
func ParseTokens ¶
func ParseTokens(env *Environment, lexer *Lexer) ([]Sexp, error)
type SexpArray ¶
type SexpArray []Sexp
func FilterArray ¶
func FilterArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
func FlatMapArray ¶
func FlatMapArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
func MapArray ¶
func MapArray(env *Environment, fun *SexpFunction, arr SexpArray) (SexpArray, error)
func (SexpArray) MarshalJSON ¶
func (SexpArray) SexpString ¶
type SexpBytes ¶
type SexpBytes struct {
// contains filtered or unexported fields
}
func NewSexpBytes ¶
func NewSexpBytesByHex ¶
func (SexpBytes) MarshalJSON ¶
func (SexpBytes) SexpString ¶
type SexpFloat ¶
type SexpFloat struct {
// contains filtered or unexported fields
}
func NewSexpFloat ¶
func NewSexpFloatInt ¶
func NewSexpFloatStr ¶
func (SexpFloat) MarshalJSON ¶
func (SexpFloat) SexpString ¶
type SexpFunction ¶
type SexpFunction struct {
// contains filtered or unexported fields
}
func MakeFunction ¶
func MakeFunction(name string, nargs int, varargs bool, fun Function, opts ...FuntionOption) *SexpFunction
func MakeUserFunction ¶
func MakeUserFunction(name string, ufun UserFunction, opts ...FuntionOption) *SexpFunction
func (*SexpFunction) Clone ¶
func (sf *SexpFunction) Clone() *SexpFunction
func (*SexpFunction) Doc ¶
func (sf *SexpFunction) Doc() string
func (*SexpFunction) MarshalJSON ¶
func (a *SexpFunction) MarshalJSON() ([]byte, error)
func (*SexpFunction) Name ¶
func (sf *SexpFunction) Name() string
func (*SexpFunction) SexpString ¶
func (sf *SexpFunction) SexpString() string
type SexpHash ¶
type SexpHash struct { Map map[int][]*SexpPair KeyOrder []Sexp // must user pointers here, else hset! will fail to update. NumKeys int }
func FilterHash ¶
func FilterHash(env *Environment, fun *SexpFunction, hash *SexpHash) (*SexpHash, error)
func (*SexpHash) HashDelete ¶
func (*SexpHash) HashGetDefault ¶
func (*SexpHash) MarshalJSON ¶
func (*SexpHash) SexpString ¶
type SexpInt ¶
type SexpInt struct {
// contains filtered or unexported fields
}
func NewSexpInt ¶
func NewSexpInt64 ¶
func NewSexpIntStr ¶
func NewSexpUint64 ¶
func (SexpInt) MarshalJSON ¶
func (SexpInt) SexpString ¶
func (SexpInt) ShiftRight ¶
type SexpPair ¶
type SexpPair struct {
// contains filtered or unexported fields
}
func (*SexpPair) MarshalJSON ¶
func (*SexpPair) SexpString ¶
type SexpSentinel ¶
type SexpSentinel int
const ( SexpNull SexpSentinel = iota SexpEnd SexpMarker )
func (SexpSentinel) MarshalJSON ¶
func (a SexpSentinel) MarshalJSON() ([]byte, error)
func (SexpSentinel) SexpString ¶
func (sent SexpSentinel) SexpString() string
type SexpSymbol ¶
type SexpSymbol struct {
// contains filtered or unexported fields
}
func (SexpSymbol) MarshalJSON ¶
func (a SexpSymbol) MarshalJSON() ([]byte, error)
func (SexpSymbol) Name ¶
func (sym SexpSymbol) Name() string
func (SexpSymbol) Number ¶
func (sym SexpSymbol) Number() int
func (SexpSymbol) SexpString ¶
func (sym SexpSymbol) SexpString() string
type SquashInstr ¶
type SquashInstr int
func (SquashInstr) Execute ¶
func (s SquashInstr) Execute(env *Environment) error
func (SquashInstr) InstrString ¶
func (s SquashInstr) InstrString() string
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func (*Stack) BindSymbol ¶
func (stack *Stack) BindSymbol(sym SexpSymbol, expr Sexp) error
func (*Stack) IsStackElem ¶
func (stack *Stack) IsStackElem()
func (*Stack) LookupSymbol ¶
func (stack *Stack) LookupSymbol(sym SexpSymbol) (Sexp, error)
func (*Stack) PrintStack ¶
func (*Stack) PushAddr ¶
func (stack *Stack) PushAddr(function *SexpFunction, pc int)
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func DecodeAtom ¶
func DecodeBrace ¶
type TokenType ¶
type TokenType int
const ( TokenLParen TokenType = iota TokenRParen TokenLSquare TokenRSquare TokenLCurly TokenRCurly TokenDot TokenQuote TokenSharpQuote TokenBacktick TokenLambda TokenTilde TokenTildeAt TokenSymbol TokenBool TokenDecimal TokenHex TokenOct TokenBinary TokenBinaryStream TokenFloat TokenChar TokenString TokenEnd )
type UserFunction ¶
type UserFunction func(*Environment, []Sexp) (Sexp, error)
func GetAnyToBool ¶
func GetAnyToBool(name string) UserFunction
func GetAnyToBytes ¶
func GetAnyToBytes(name string) UserFunction
func GetAnyToChar ¶
func GetAnyToChar(name string) UserFunction
func GetAnyToFloat ¶
func GetAnyToFloat(name string) UserFunction
func GetAnyToInteger ¶
func GetAnyToInteger(name string) UserFunction
func GetAnyToSymbolFunction ¶
func GetAnyToSymbolFunction(name string) UserFunction
func GetAppendFunction ¶
func GetAppendFunction(name string) UserFunction
func GetApplyFunction ¶
func GetApplyFunction(name string) UserFunction
func GetArrayAccessFunction ¶
func GetArrayAccessFunction(name string) UserFunction
func GetConcatFunction ¶
func GetConcatFunction(name string) UserFunction
func GetConsFunction ¶
func GetConsFunction(name string) UserFunction
func GetConstructorFunction ¶
func GetConstructorFunction(name string) UserFunction
func GetEvalFunction ¶
func GetEvalFunction(name string) UserFunction
func GetExistFunction ¶
func GetExistFunction(name string) UserFunction
func GetFirstFunction ¶
func GetFirstFunction(name string) UserFunction
func GetGenSymFunction ¶
func GetGenSymFunction(name string) UserFunction
func GetHashAccessFunction ¶
func GetHashAccessFunction(name string) UserFunction
func GetLenFunction ¶
func GetLenFunction(name string) UserFunction
func GetMakeArrayFunction ¶
func GetMakeArrayFunction(name string) UserFunction
func GetNotFunction ¶
func GetNotFunction(name string) UserFunction
func GetReadFunction ¶
func GetReadFunction(name string) UserFunction
func GetRestFunction ¶
func GetRestFunction(name string) UserFunction
func GetSexpString ¶
func GetSexpString(name string) UserFunction
func GetSgetFunction ¶
func GetSgetFunction(name string) UserFunction
func GetSliceFunction ¶
func GetSliceFunction(name string) UserFunction
func GetSourceFileFunction ¶
func GetSourceFileFunction(name string) UserFunction
func GetStringifyFunction ¶
func GetStringifyFunction(name string) UserFunction
GetStringifyFunction return s-expr's string representation
func GetSymnumFunction ¶
func GetSymnumFunction(name string) UserFunction
func GetTypeFunction ¶
func GetTypeFunction(name string) UserFunction
func GetTypeQueryFunction ¶
func GetTypeQueryFunction(name string) UserFunction
type VectorizeInstr ¶
type VectorizeInstr int
func (VectorizeInstr) Execute ¶
func (s VectorizeInstr) Execute(env *Environment) error
func (VectorizeInstr) InstrString ¶
func (s VectorizeInstr) InstrString() string
Source Files ¶
- address.go
- builtin.go
- comparisons.go
- containerutils.go
- datastack.go
- doc.go
- environment.go
- expressions.go
- file.go
- func_map.go
- functions.go
- generator.go
- json.go
- lexer.go
- parser.go
- pool.go
- s-array.go
- s-bool.go
- s-bytes.go
- s-char.go
- s-float.go
- s-function.go
- s-hash.go
- s-integer.go
- s-list.go
- s-string.go
- s-symbol.go
- scopes.go
- stack.go
- typeutils.go
- utils.go
- vm.go
Click to show internal directories.
Click to hide internal directories.