Documentation ¶
Overview ¶
This project does not use godoc. Instead there is extensive and detailed description of the language features maintained on the wiki. See the following link.
Index ¶
- Constants
- Variables
- func AllBuiltinFunctions() map[string]ZlispUserFunction
- func Blake2bUint64(raw []byte) uint64
- func Chomp(by []byte) []byte
- func ClosureToString(f *SexpFunction, env *Zlisp) string
- func CoreFunctions() map[string]ZlispUserFunction
- func CountPostHook(env *Zlisp, name string, retval Sexp)
- func CountPreHook(env *Zlisp, name string, args []Sexp)
- func DecodeChar(atom string) (string, error)
- func DirExists(name string) bool
- func DumpFunction(fun ZlispFunction, pc int)
- func EncodingFunctions() map[string]ZlispUserFunction
- func EscapeChar(char rune) (rune, error)
- func FileExists(name string) bool
- func GetEmbedPath(e []EmbedPath) string
- func GoToJson(iface interface{}) []byte
- func GoToMsgpack(iface interface{}) ([]byte, error)
- func HashCountKeys(hash *SexpHash) int
- func HashExpression(env *Zlisp, expr Sexp) (int, error)
- func HashIsEmpty(hash *SexpHash) bool
- func IsArray(expr Sexp) bool
- func IsAssignmentList(expr Sexp, pos int) (bool, int)
- func IsChar(expr Sexp) bool
- func IsEmpty(expr Sexp) bool
- func IsExactlyDoublePointer(target interface{}) bool
- func IsExactlySinglePointer(target interface{}) bool
- func IsExactlySinglePointerType(typ reflect.Type) bool
- func IsFloat(expr Sexp) bool
- func IsFunc(expr Sexp) bool
- func IsHash(expr 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 JsonToGo(json []byte) (interface{}, error)
- func ListLen(expr Sexp) (int, error)
- func MergeFuncMap(funcs ...map[string]ZlispUserFunction) map[string]ZlispUserFunction
- func MsgpackToGo(msgp []byte) (interface{}, error)
- func MyWordCompleter(line string, pos int) (head string, c []string, tail string)
- func NilOrHoldsNil(iface interface{}) bool
- func P(format string, stuff ...interface{})
- func PointerDepth(typ reflect.Type) int
- func ReflectionFunctions() map[string]ZlispUserFunction
- func RegisterDemoStructs()
- func RemoveCommasFilter(x Sexp) bool
- func RemoveCommentsFilter(x Sexp) bool
- func RemoveEndsFilter(x Sexp) bool
- func Repl(env *Zlisp, cfg *ZlispConfig)
- func ReplMain(cfg *ZlispConfig)
- func SandboxSafeFunctions() map[string]ZlispUserFunction
- func SetHashKeyOrder(hash *SexpHash, keyOrd Sexp) error
- func SetShellCmd()
- func SexpToGo(sexp Sexp, env *Zlisp, dedup map[*SexpHash]interface{}) (result interface{})
- func SexpToGoStructs(sexp Sexp, target interface{}, env *Zlisp, dedup map[*SexpHash]interface{}) (result interface{}, err error)
- func SexpToJson(exp Sexp) string
- func SexpToMsgpack(exp Sexp) ([]byte, interface{})
- func StrFunctions() map[string]ZlispUserFunction
- func StringToRunes(str string) []rune
- func SystemFunctions() map[string]ZlispUserFunction
- func TSPrintf(format string, a ...interface{})
- func UseConveyDummy()
- func VPrintf(format string, a ...interface{})
- func Version() string
- func WPrintf(format string, a ...interface{})
- type AddFuncScopeHelper
- type AddFuncScopeInstr
- type AddScopeInstr
- type Address
- type AssignInstr
- type BindlistInstr
- type Booter
- type BranchInstr
- type BreakInstr
- type CallInstr
- type ClearStackmarkInstr
- type Closing
- func (c *Closing) IsStackElem()
- func (c *Closing) LookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (c *Closing) LookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
- func (c *Closing) Show(env *Zlisp, ps *PrintState, label string) (string, error)
- func (c *Closing) TopScope() *Scope
- type ContinueInstr
- type CreateClosureInstr
- type DataStackElem
- type DebugInstr
- type DispatchInstr
- type DupInstr
- type EmbedPath
- type EnvToStackInstr
- type Event
- func (z *Event) DecodeMsg(dc *msgp.Reader) (err error)
- func (ev *Event) DisplayEvent(from string)
- func (z *Event) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Event) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Event) Msgsize() (s int)
- func (z *Event) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExplodeInstr
- type Filter
- type Flyer
- 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) GenerateAssignment(expr *SexpPair, assignPos int) error
- func (gen *Generator) GenerateBegin(expressions []Sexp) error
- func (gen *Generator) GenerateBreak(args []Sexp) error
- func (gen *Generator) GenerateBuilder(fun Sexp, args []Sexp) error
- func (gen *Generator) GenerateCall(expr *SexpPair) error
- func (gen *Generator) GenerateCallBySymbol(sym *SexpSymbol, args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateCond(args []Sexp) error
- func (gen *Generator) GenerateContinue(args []Sexp) error
- func (gen *Generator) GenerateDebug(diag string) error
- func (gen *Generator) GenerateDef(args []Sexp, opname string) error
- func (gen *Generator) GenerateDefmac(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateDefn(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateDispatch(fun Sexp, args []Sexp) error
- func (gen *Generator) GenerateFn(args []Sexp, orig Sexp) error
- func (gen *Generator) GenerateForLoop(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) GenerateMultiDef(args []Sexp) error
- func (gen *Generator) GenerateNewScope(expressions []Sexp) error
- func (gen *Generator) GeneratePackage(expressions []Sexp) error
- func (gen *Generator) GenerateQuote(args []Sexp) error
- func (gen *Generator) GenerateReturn(xs []Sexp) error
- func (gen *Generator) GenerateShortCircuit(or bool, args []Sexp) error
- func (gen *Generator) GenerateSyntaxQuote(args []Sexp) error
- func (gen *Generator) GetLHS(arg Sexp, opname string) (*SexpSymbol, error)
- func (gen *Generator) Reset()
- type GoStructRegistryType
- func (gsr *GoStructRegistryType) GetOrCreatePointerType(pointedToType *RegisteredType) *RegisteredType
- func (gsr *GoStructRegistryType) GetOrCreateSliceType(rt *RegisteredType) *RegisteredType
- func (r *GoStructRegistryType) Lookup(name string) *RegisteredType
- func (r *GoStructRegistryType) RegisterBuiltin(name string, e *RegisteredType)
- func (r *GoStructRegistryType) RegisterPointer(pointedToName string, pointedToType *RegisteredType) *RegisteredType
- func (r *GoStructRegistryType) RegisterUserdef(e *RegisteredType, hasShadowStruct bool, names ...string)
- type GotoInstr
- type HashFieldDet
- type HashizeInstr
- type Hellcat
- type Hornet
- type InfixOp
- type Instruction
- type IntegerOp
- type JumpInstr
- type KiSlice
- type LabelInstr
- type LeftMuncher
- type Lexer
- func (lex *Lexer) AddNextStream(s io.RuneScanner)
- func (lexer *Lexer) AppendToken(tok Token)
- func (x *Lexer) DecodeAtom(atom string) (Token, error)
- func (x *Lexer) DecodeBrace(brace rune) Token
- func (lex *Lexer) EmptyToken() Token
- func (lexer *Lexer) GetNextToken() (tok Token, err error)
- func (lexer *Lexer) LexNextRune(r rune) error
- func (lexer *Lexer) Linenum() int
- func (lexer *Lexer) PeekNextToken() (tok Token, err error)
- func (lexer *Lexer) PrependToken(tok Token)
- func (lex *Lexer) PromoteNextStream() (ok bool)
- func (lex *Lexer) Reset()
- func (lex *Lexer) Token(typ TokenType, str string) Token
- type LexerState
- type Loop
- type LoopStartInstr
- type MakeGoStructFunc
- type NestInner
- type NestOuter
- type NumericOp
- type Parser
- func (p *Parser) GetMoreInput(deliverThese []Sexp, errorToReport error) error
- func (p *Parser) HaveStuffToSend() chan []ParserReply
- func (p *Parser) NewInput(s io.RuneScanner)
- func (parser *Parser) ParseArray(depth int) (Sexp, error)
- func (parser *Parser) ParseBlockComment(start *Token) (sx Sexp, err error)
- func (parser *Parser) ParseExpression(depth int) (res Sexp, err error)
- func (parser *Parser) ParseInfix(depth int) (Sexp, error)
- func (parser *Parser) ParseList(depth int) (sx Sexp, err error)
- func (p *Parser) ParseTokens() ([]Sexp, error)
- func (p *Parser) Reset()
- func (p *Parser) ResetAddNewInput(s io.RuneScanner)
- func (p *Parser) Start()
- func (p *Parser) Stop() error
- type ParserReply
- type Person
- type Plane
- type PopInstr
- type PopScopeTransferToDataStackInstr
- type PopStackPutEnvInstr
- type PopUntilStackmarkInstr
- type PostHook
- type Pratt
- type PreHook
- type PrintState
- type Prompter
- type PushInstr
- type PushStackmarkInstr
- type RecordDefn
- type RegisteredType
- type RemoveScopeInstr
- type ReturnInstr
- type RightMuncher
- type Scope
- func (s *Scope) CloneScope() *Scope
- func (scope *Scope) DeleteSymbolInScope(sym *SexpSymbol) error
- func (s Scope) IsStackElem()
- func (s *Scope) SexpString(ps *PrintState) string
- func (scop *Scope) Show(env *Zlisp, ps *PrintState, label string) (s string, err error)
- func (s *Scope) Type() *RegisteredType
- func (scope *Scope) UpdateSymbolInScope(sym *SexpSymbol, expr Sexp) error
- type Seen
- type Selector
- type SetOfPlanes
- type Sexp
- func AddressOfFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func AppendFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ApplyFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ArrayAccessFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ArrayIndexFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ArrayOfFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func AsTmFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func AssignmentFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func BaseTypeConstructorFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func BinaryIntFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func BitwiseFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func CallGoMethodFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func CallZMethodOnRecordFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ChanTxFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ColonAccessBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func CommaBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func CompareFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ComplementFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ConcatArray(arr *SexpArray, rest []Sexp) (Sexp, error)
- func ConcatFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ConcatList(a *SexpPair, b Sexp) (Sexp, error)
- func ConsFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ConstructorFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func CreateGoroutineMacro(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func DeclareMsgpackMapFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func DefinedFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func DemoNestInnerOuterFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func DerefFunction(env *Zlisp, name string, args []Sexp) (result Sexp, err error)
- func DotFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func DumpClosureEnvFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func EvalFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ExitFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ExpectErrorBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func FirstFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func FlattenToWordsFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func FromGoFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func FuncBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GOOSFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GenericAccessFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GenericHpairFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GensymFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GoFieldListFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GoMethodListFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GoToSexp(iface interface{}, env *Zlisp) (Sexp, error)
- func GobDecodeFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GobEncodeFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func GoonDumpFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func HashAccessFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func HashColonFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func HashIndexFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ImportPackageBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func InfixBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func IntegerDo(op IntegerOp, a, b Sexp) (Sexp, error)
- func InterfaceBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func IsNaNFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func JoinSymFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func JsonFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func JsonToSexp(json []byte, env *Zlisp) (Sexp, error)
- func LenFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ListToArray(expr Sexp) ([]Sexp, error)
- func MakeArrayFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func MakeChanFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func MakeList(expressions []Sexp) Sexp
- func MapArray(env *Zlisp, fun *SexpFunction, arr *SexpArray) (Sexp, error)
- func MapFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func MapList(env *Zlisp, fun *SexpFunction, expr Sexp) (Sexp, error)
- func MsgpackMapMacro(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func MsgpackToSexp(msgp []byte, env *Zlisp) (Sexp, error)
- func NotFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func NowFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func NumericDo(op NumericOp, a, b Sexp) (Sexp, error)
- func NumericFloatDo(op NumericOp, a, b *SexpFloat) Sexp
- func NumericFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func NumericIntDo(op NumericOp, a, b *SexpInt) Sexp
- func NumericMatchChar(op NumericOp, a *SexpChar, b Sexp) (Sexp, error)
- func NumericMatchFloat(op NumericOp, a *SexpFloat, b Sexp) (Sexp, error)
- func NumericMatchInt(op NumericOp, a *SexpInt, b Sexp) (Sexp, error)
- func OldEvalFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func PointerOrNumericFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func PointerToFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func PrintFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func QuoteListFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RandomFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RawToStringFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ReadFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ReadGreenpackFromFileFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RegexpCompile(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RegexpFind(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RemoveSymFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func RestFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ScriptFacingRegisterDemoStructs(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SecondFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SetPrettyPrintFlag(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SgetFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SimpleSourceFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SliceFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SliceOfFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SlurpfileFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SourceFileFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SplitStringFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SplitStringOnNewlinesFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StartGoroutineFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StopFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func Str2SymFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StringUtilFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StringifyFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StructBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func StructConstructorFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func Sym2StrFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SymnumFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SystemBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func SystemFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ThreadMapFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func TimeitFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func ToGoFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func TypeListFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func TypeQueryFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func VarBuilder(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func WriteShadowGreenpackToFileFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- func WriteToFileFunction(env *Zlisp, name string, args []Sexp) (Sexp, error)
- type SexpArray
- type SexpArraySelector
- type SexpBool
- type SexpChannel
- type SexpChar
- type SexpClosureEnv
- type SexpComma
- type SexpComment
- type SexpError
- type SexpField
- type SexpFloat
- type SexpFunction
- func (sf *SexpFunction) ClosingLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (sf *SexpFunction) ClosingLookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
- func (sf *SexpFunction) Copy() *SexpFunction
- func (sf *SexpFunction) SetClosing(clos *Closing)
- func (sf *SexpFunction) SexpString(ps *PrintState) string
- func (sf *SexpFunction) ShowClosing(env *Zlisp, ps *PrintState, label string) (string, error)
- func (sf *SexpFunction) Type() *RegisteredType
- type SexpGoroutine
- type SexpHash
- func (h *SexpHash) BindSymbol(key *SexpSymbol, val Sexp) error
- func (p *SexpHash) CloneFrom(src *SexpHash)
- func (p *SexpHash) CopyMap() *map[int][]*SexpPair
- func (h *SexpHash) DotPathHashGet(env *Zlisp, sym *SexpSymbol) (Sexp, error)
- func (h *SexpHash) FillHashFromShadow(env *Zlisp, src interface{}) error
- func (hash *SexpHash) HashDelete(key Sexp) error
- func (hash *SexpHash) HashGet(env *Zlisp, key Sexp) (res Sexp, err error)
- func (hash *SexpHash) HashGetDefault(env *Zlisp, key Sexp, defaultval Sexp) (Sexp, error)
- func (hash *SexpHash) HashPairi(pos int) (*SexpPair, error)
- func (hash *SexpHash) HashSet(key Sexp, val Sexp) error
- func (h *SexpHash) Lookup(env *Zlisp, key Sexp) (expr Sexp, err error)
- func (h *SexpHash) NewSexpHashSelector(sym *SexpSymbol) *SexpHashSelector
- func (h *SexpHash) RunZmethod(method string, args []Sexp) (Sexp, error)
- func (h *SexpHash) SetDefnEnv(p *SexpHash)
- func (h *SexpHash) SetGoStructFactory(factory *RegisteredType)
- func (h *SexpHash) SetMain(p *SexpFunction)
- func (h *SexpHash) SetMethodList(env *Zlisp) error
- func (hash *SexpHash) SexpString(ps *PrintState) string
- func (hash *SexpHash) ShortName() string
- func (r *SexpHash) Type() *RegisteredType
- func (h *SexpHash) TypeCheckField(key Sexp, val Sexp) error
- type SexpHashSelector
- type SexpInt
- type SexpInterfaceDecl
- type SexpPair
- type SexpPointer
- type SexpRaw
- type SexpReflect
- type SexpRegexp
- type SexpSemicolon
- type SexpSentinel
- type SexpStackmark
- type SexpStr
- type SexpSymbol
- type SexpTime
- type SexpUserVarDefn
- type ShortNamer
- type Showable
- type Snoopy
- type SquashInstr
- type Stack
- func (stack *Stack) BindSymbol(sym *SexpSymbol, expr Sexp) error
- func (stack *Stack) Clone() *Stack
- func (stack *Stack) DeleteSymbolFromTopOfStackScope(sym *SexpSymbol) error
- 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) GetTop() StackElem
- func (stack *Stack) IsEmpty() bool
- func (stack *Stack) IsStackElem()
- func (stack *Stack) LookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (stack *Stack) LookupSymbolNonGlobal(sym *SexpSymbol) (Sexp, error, *Scope)
- func (stack *Stack) LookupSymbolUntilFunction(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- 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) PrintScopeStack()
- func (stack *Stack) PrintStack()
- 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) PushExpressions(expr []Sexp) error
- func (stack *Stack) PushScope()
- func (s *Stack) SexpString(ps *PrintState) string
- func (stack *Stack) Show(env *Zlisp, ps *PrintState, label string) (string, error)
- func (stack *Stack) Size() int
- func (stack *Stack) Top() int
- func (stack *Stack) TruncateToSize(newsize int)
- func (s *Stack) Type() *RegisteredType
- type StackElem
- type StmtMuncher
- type SymtabE
- type SymtabSorter
- type Token
- type TokenType
- type TypeCheckable
- type UpdateInstr
- type VectorizeInstr
- type Weather
- func (z *Weather) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Weather) EncodeMsg(en *msgp.Writer) (err error)
- func (w *Weather) IsSunny() bool
- func (z *Weather) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Weather) Msgsize() (s int)
- func (z *Weather) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Wings
- type Zlisp
- func (env *Zlisp) AddBuilder(name string, function ZlispUserFunction)
- func (env *Zlisp) AddFunction(name string, function ZlispUserFunction)
- func (env *Zlisp) AddGlobal(name string, obj Sexp)
- func (env *Zlisp) AddMacro(name string, function ZlispUserFunction)
- func (env *Zlisp) AddPostHook(fun PostHook)
- func (env *Zlisp) AddPreHook(fun PreHook)
- func (env *Zlisp) Apply(fun *SexpFunction, args []Sexp) (Sexp, error)
- func (env *Zlisp) Assignment(op string, bp int) *InfixOp
- func (env *Zlisp) CallFunction(function *SexpFunction, nargs int) error
- func (env *Zlisp) CallUserFunction(function *SexpFunction, name string, nargs int) (nargReturned int, err error)
- func (env *Zlisp) Clear()
- func (env *Zlisp) Clone() *Zlisp
- func (env *Zlisp) Compare(a Sexp, b Sexp) (int, error)
- func (env *Zlisp) CurrentFunctionSize() int
- func (env *Zlisp) DetectSigils(sym *SexpSymbol)
- func (env *Zlisp) DumpEnvironment()
- func (env *Zlisp) DumpFunctionByName(name string) error
- func (env *Zlisp) DumpSymTable()
- func (env *Zlisp) Duplicate() *Zlisp
- func (env *Zlisp) EliminateColonAndCommaFromArgs(args []Sexp) []Sexp
- func (env *Zlisp) EvalExpressions(xs []Sexp) (Sexp, error)
- func (env *Zlisp) EvalString(str string) (Sexp, error)
- func (env *Zlisp) FilterAny(x Sexp, f Filter) (filtered Sexp, keep bool)
- func (env *Zlisp) FilterArray(x []Sexp, f Filter) []Sexp
- func (env *Zlisp) FilterHash(h *SexpHash, f Filter) *SexpHash
- func (env *Zlisp) FilterList(h *SexpPair, f Filter) Sexp
- func (env *Zlisp) FindLoop(target *Loop) (int, error)
- func (env *Zlisp) FindObject(name string) (Sexp, bool)
- func (env *Zlisp) FunctionCallNameTypeCheck(f *SexpFunction, nargs *int) error
- func (env *Zlisp) GenSymbol(prefix string) *SexpSymbol
- func (env *Zlisp) GetStackTrace(err error) string
- func (env *Zlisp) HasMacro(sym *SexpSymbol) bool
- func (env *Zlisp) ImportBaseTypes()
- func (env *Zlisp) ImportChannels()
- func (env *Zlisp) ImportDemoData()
- func (env *Zlisp) ImportEval()
- func (env *Zlisp) ImportGoroutines()
- func (env *Zlisp) ImportMsgpackMap()
- func (env *Zlisp) ImportPackageBuilder()
- func (env *Zlisp) ImportRandom()
- func (env *Zlisp) ImportRegex()
- func (env *Zlisp) ImportTime()
- func (env *Zlisp) Infix(op string, bp int) *InfixOp
- func (env *Zlisp) InfixF(op string, bp int, f func(env *Zlisp, op string, bp int) *InfixOp) *InfixOp
- func (env *Zlisp) Infixr(op string, bp int) *InfixOp
- func (env *Zlisp) InitInfixOps()
- func (env *Zlisp) IsBuiltinSym(sym *SexpSymbol) (builtin bool, typ string)
- func (env *Zlisp) LeftBindingPower(sx Sexp) (int, error)
- func (env *Zlisp) LexicalBindSymbol(sym *SexpSymbol, expr Sexp) error
- func (env *Zlisp) LexicalLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
- func (env *Zlisp) LoadExpressions(xs []Sexp) error
- func (env *Zlisp) LoadFile(file io.Reader) error
- func (env *Zlisp) LoadStream(stream io.RuneScanner) error
- func (env *Zlisp) LoadString(str string) error
- func (env *Zlisp) MakeDotSymbol(name string) *SexpSymbol
- func (env *Zlisp) MakeFunction(name string, nargs int, varargs bool, fun ZlispFunction, orig Sexp) *SexpFunction
- func (env *Zlisp) MakeSymbol(name string) *SexpSymbol
- func (env *Zlisp) NewNamedScope(name string) *Scope
- func (env *Zlisp) NewParser() *Parser
- func (env *Zlisp) NewScope() *Scope
- func (env *Zlisp) NewSexpArray(arr []Sexp) *SexpArray
- func (env *Zlisp) NewStack(size int) *Stack
- func (env *Zlisp) ParseFile(file string) ([]Sexp, error)
- func (env *Zlisp) PostfixAssign(op string, bp int) *InfixOp
- func (env *Zlisp) Prefix(op string, bp int) *InfixOp
- func (env *Zlisp) ReachedEnd() bool
- func (env *Zlisp) ReplLineInfixWrap(line string) string
- func (env *Zlisp) ResolveDotSym(arg []Sexp) ([]Sexp, error)
- func (env *Zlisp) ReturnFromFunction() error
- func (env *Zlisp) Run() (Sexp, error)
- func (env *Zlisp) SetBooter(b Booter)
- func (env *Zlisp) ShowGlobalStack() error
- func (env *Zlisp) ShowStackStackAndScopeStack() error
- func (env *Zlisp) SourceExpressions(expressions []Sexp) error
- func (env *Zlisp) SourceFile(file *os.File) error
- func (env *Zlisp) SourceStream(stream io.RuneScanner) error
- func (env *Zlisp) StandardSetup()
- func (env *Zlisp) Stop() error
- func (env *Zlisp) SubstituteRHS(args []Sexp) ([]Sexp, error)
- type ZlispConfig
- type ZlispFunction
- type ZlispUserFunction
Constants ¶
const CallStackSize = 25
const DataStackSize = 100
const LoopStackSize = 5
const ScopeStackSize = 50
const SliceDefaultCap = 10
const StackStackSize = 5
const YesIamEmbeddedAbove = true
Variables ¶
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]+$") // SymbolRegex = regexp.MustCompile("^[^'#]+$") // (Sigil) symbols can begin with #, $, ?, but // sigils cannot appear later in any symbol. // Symbols cannot contain whitespace nor `~`, `@`, `(`, `)`, `[`, `]`, // `{`, `}`, `'`, `#`, `^`, `\`, `|`, `%`, `"`, `;`. They can optionally // end in `:`. // Nor, obviously, can symbols contain backticks, "`". // Symbols cannot start with a number. DotSymbols cannot have a number // as the first character after '.' SymbolRegex = regexp.MustCompile(`^[#$?]?[^#$?':;\\~@\[\]{}\^|"()%0-9,&][^'#:;\\~@\[\]{}\^|"()%,&*\-]*[:]?$`) // dot symbol examples: `.`, `.a`, `.a.b`, `.a.b.c` // dot symbol non-examples: `.a.`, `..` DotSymbolRegex = regexp.MustCompile(`^[.]$|^([.][^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*)+$|^[^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*([.][^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,*+\-]*)+$`) DotPartsRegex = regexp.MustCompile(`[.]?[^'#:;\\~@\[\]{}\^|"()%.0-9,][^'#:;\\~@\[\]{}\^|"()%.,]*`) CharRegex = regexp.MustCompile("^'\\\\?.'$") FloatRegex = regexp.MustCompile("^-?([0-9]+\\.[0-9]*)$|-?(\\.[0-9]+)$|-?([0-9]+(\\.[0-9]*)?[eE](-?[0-9]+))$") ComplexRegex = regexp.MustCompile("^-?([0-9]+\\.[0-9]*)i?$|-?(\\.[0-9]+)i?$|-?([0-9]+(\\.[0-9]*)?[eE](-?[0-9]+))i?$") BuiltinOpRegex = regexp.MustCompile(`^(\+\+|\-\-|\+=|\-=|=|==|:=|\+|\-|\*|<|>|<=|>=|<-|->|\*=|/=|\*\*|!|!=|<!)$`) )
var EndTk = Token{/* contains filtered or unexported fields */}
var ErrBadBreakLabel = fmt.Errorf("bad break label")
var ErrBadContinueLabel = fmt.Errorf("bad continue label")
var ErrBadLoopSyntax = fmt.Errorf("for loop: first argument must be a label or a vector of [init predicate advance]")
var ErrBadQuotedSym = fmt.Errorf("not a quoted symbol")
var ErrMoreInputNeeded = fmt.Errorf("parser needs more input")
var ErrShuttingDown error = fmt.Errorf("lexer shutting down")
var GITLASTCOMMIT string
var GITLASTTAG string
version information. See Makefile and gitcommit.go for update/init.
var KeyNotSymbol = fmt.Errorf("key is not a symbol")
var ListRegisteredTypes = []string{}
consistently ordered list of all registered types (created at init time).
var MethodNotFound = fmt.Errorf("method not found")
var MissingFunction = &SexpFunction{name: "__missing", user: true}
var NYC *time.Location
var NaN float64
var NoAttachedGoStruct = fmt.Errorf("hash has no attach Go struct")
var NoExpressionsFound = fmt.Errorf("No expressions found")
var NotAList = errors.New("not a list")
var OutOfBounds error = errors.New("jump out of bounds")
var ParserHaltRequested = fmt.Errorf("parser halt requested")
var Q = func(quietly_ignored ...interface{}) {} // quiet
var ReservedWords = []string{"byte", "defbuild", "builder", "field", "and", "or", "cond", "quote", "def", "mdef", "fn", "defn", "begin", "let", "letseq", "assert", "defmac", "macexpand", "syntaxQuote", "include", "for", "set", "break", "continue", "newScope", "_ls", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float32", "float64", "complex64", "complex128", "bool", "string", "any", "break", "case", "chan", "const", "continue", "default", "else", "defer", "fallthrough", "for", "func", "go", "goto", "if", "import", "interface", "map", "package", "range", "return", "select", "struct", "switch", "type", "var", "append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover", "null", "nil", "-", "+", "--", "++", "-=", "+=", ":=", "=", ">", "<", ">=", "<=", "send", "NaN", "nan"}
var ResetRequested = fmt.Errorf("parser reset requested")
var SexpEnd = &SexpSentinel{Val: 1}
var SexpFloatSize = 64
var SexpIntSize = 64
var SexpMarker = &SexpSentinel{Val: 2}
var SexpNull = &SexpSentinel{Val: 0}
these are values now so that they also have addresses.
var ShellCmd string = "/bin/bash"
var StackUnderFlowErr = fmt.Errorf("invalid stack access: underflow")
var SymNotFound = errors.New("symbol not found")
var UnexpectedEnd error = errors.New("Unexpected end of input")
var UtcTz *time.Location
var V = VPrintf
var Verbose bool // set to true to debug
var W = WPrintf
var Working bool // currently under investigation
var WrongNargs error = fmt.Errorf("wrong number of arguments")
var WrongType error = errors.New("operands have invalid type")
Functions ¶
func AllBuiltinFunctions ¶
func AllBuiltinFunctions() map[string]ZlispUserFunction
AllBuiltinFunctions returns all built in functions
func Blake2bUint64 ¶
Blake2bUint64 returns an 8 byte BLAKE2b cryptographic hash of the raw.
we're using the pure go: https://github.com/dchest/blake2b
but the C-wrapped refence may be helpful as well --
reference: https://godoc.org/github.com/codahale/blake2 reference: https://blake2.net/ reference: https://tools.ietf.org/html/rfc7693
func ClosureToString ¶
func ClosureToString(f *SexpFunction, env *Zlisp) string
func CoreFunctions ¶
func CoreFunctions() map[string]ZlispUserFunction
CoreFunctions returns all of the core logic
func CountPostHook ¶
func CountPreHook ¶
func DecodeChar ¶
func EncodingFunctions ¶
func EncodingFunctions() map[string]ZlispUserFunction
func EscapeChar ¶
func FileExists ¶
func GetEmbedPath ¶
func GoToMsgpack ¶
func HashCountKeys ¶
func HashIsEmpty ¶
func IsExactlyDoublePointer ¶
func IsExactlyDoublePointer(target interface{}) bool
true if target is of type **T where T is a struct/string/int/other-non-pointer type.
func IsExactlySinglePointer ¶
func IsExactlySinglePointer(target interface{}) bool
true if target is type *T where T is a struct/string/int/other-non-pointer type.
func MergeFuncMap ¶
func MergeFuncMap(funcs ...map[string]ZlispUserFunction) map[string]ZlispUserFunction
MergeFuncMap returns the union of the two given maps
func MyWordCompleter ¶
complete phrases that start with '('
func NilOrHoldsNil ¶
func NilOrHoldsNil(iface interface{}) bool
detect if inteface is holding anything
func P ¶
func P(format string, stuff ...interface{})
P is a shortcut for a call to fmt.Printf that implicitly starts and ends its message with a newline.
func PointerDepth ¶
func ReflectionFunctions ¶
func ReflectionFunctions() map[string]ZlispUserFunction
func RegisterDemoStructs ¶
func RegisterDemoStructs()
func RemoveCommasFilter ¶
detect SexpComma values and return false on them to filter them out.
func RemoveCommentsFilter ¶
func RemoveEndsFilter ¶
detect SexpEnd values and return false on them to filter them out.
func Repl ¶
func Repl(env *Zlisp, cfg *ZlispConfig)
func SandboxSafeFunctions ¶
func SandboxSafeFunctions() map[string]ZlispUserFunction
SandboxSafeFuncs returns all functions that are safe to run in a sandbox
func SetHashKeyOrder ¶
func SexpToGo ¶
translate an Sexpr to a go value that doesn't depend on any Sexp/Zlisp types. Zlisp maps will get turned into map[string]interface{}. This is mostly just an exercise in type conversion.
on first entry, dedup can be nil. We use it to write the
same pointer for a SexpHash used in more than one place.
func SexpToGoStructs ¶
func SexpToGoStructs( sexp Sexp, target interface{}, env *Zlisp, dedup map[*SexpHash]interface{}, ) (result interface{}, err error)
try to convert to registered go structs if possible, filling in the structure of target (should be a pointer).
func SexpToMsgpack ¶
translate to sexp -> json -> go -> msgpack returns both the msgpack []bytes and the go intermediary
func StrFunctions ¶
func StrFunctions() map[string]ZlispUserFunction
func StringToRunes ¶
func SystemFunctions ¶
func SystemFunctions() map[string]ZlispUserFunction
Types ¶
type AddFuncScopeHelper ¶
type AddFuncScopeHelper struct {
MyFunction *SexpFunction
}
type AddFuncScopeInstr ¶
type AddFuncScopeInstr struct { Name string Helper *AddFuncScopeHelper // we need a pointer we can update later once we know MyFunction }
func (AddFuncScopeInstr) Execute ¶
func (a AddFuncScopeInstr) Execute(env *Zlisp) error
func (AddFuncScopeInstr) InstrString ¶
func (a AddFuncScopeInstr) InstrString() string
type AddScopeInstr ¶
type AddScopeInstr struct {
Name string
}
func (AddScopeInstr) Execute ¶
func (a AddScopeInstr) Execute(env *Zlisp) 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 AssignInstr ¶
type AssignInstr struct { }
func (AssignInstr) Execute ¶
func (a AssignInstr) Execute(env *Zlisp) error
func (AssignInstr) InstrString ¶
func (a AssignInstr) InstrString() string
type BindlistInstr ¶
type BindlistInstr struct {
// contains filtered or unexported fields
}
bind these symbols to the SexpPair list found at datastack top.
func (BindlistInstr) Execute ¶
func (b BindlistInstr) Execute(env *Zlisp) error
func (BindlistInstr) InstrString ¶
func (b BindlistInstr) InstrString() string
type Booter ¶
type Booter func(s interface{})
Booter provides for registering a callback for any new Go struct created by the ToGoFunction (togo).
type BranchInstr ¶
type BranchInstr struct {
// contains filtered or unexported fields
}
func (BranchInstr) Execute ¶
func (b BranchInstr) Execute(env *Zlisp) error
func (BranchInstr) InstrString ¶
func (b BranchInstr) InstrString() string
type BreakInstr ¶
type BreakInstr struct {
// contains filtered or unexported fields
}
func (*BreakInstr) Execute ¶
func (s *BreakInstr) Execute(env *Zlisp) error
func (BreakInstr) InstrString ¶
func (s BreakInstr) InstrString() string
type CallInstr ¶
type CallInstr struct {
// contains filtered or unexported fields
}
func (CallInstr) InstrString ¶
type ClearStackmarkInstr ¶
type ClearStackmarkInstr struct {
// contains filtered or unexported fields
}
erase everything up-to-and-including our mark
func (ClearStackmarkInstr) Execute ¶
func (s ClearStackmarkInstr) Execute(env *Zlisp) error
func (ClearStackmarkInstr) InstrString ¶
func (s ClearStackmarkInstr) InstrString() string
type Closing ¶
where we store our closure-supporing stack pointers
func NewClosing ¶
func (*Closing) IsStackElem ¶
func (c *Closing) IsStackElem()
func (*Closing) LookupSymbol ¶
func (*Closing) LookupSymbolUntilFunction ¶
func (c *Closing) LookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
type ContinueInstr ¶
type ContinueInstr struct {
// contains filtered or unexported fields
}
func (*ContinueInstr) Execute ¶
func (s *ContinueInstr) Execute(env *Zlisp) error
func (ContinueInstr) InstrString ¶
func (s ContinueInstr) InstrString() string
type CreateClosureInstr ¶
type CreateClosureInstr struct {
// contains filtered or unexported fields
}
when a defn or fn executes, capture the creation env.
func (CreateClosureInstr) Execute ¶
func (a CreateClosureInstr) Execute(env *Zlisp) error
func (CreateClosureInstr) InstrString ¶
func (a CreateClosureInstr) InstrString() string
type DataStackElem ¶
type DataStackElem struct {
// contains filtered or unexported fields
}
func (DataStackElem) IsStackElem ¶
func (d DataStackElem) IsStackElem()
type DebugInstr ¶
type DebugInstr struct {
// contains filtered or unexported fields
}
func (DebugInstr) Execute ¶
func (g DebugInstr) Execute(env *Zlisp) error
func (DebugInstr) InstrString ¶
func (g DebugInstr) InstrString() string
type DispatchInstr ¶
type DispatchInstr struct {
// contains filtered or unexported fields
}
func (DispatchInstr) Execute ¶
func (d DispatchInstr) Execute(env *Zlisp) error
func (DispatchInstr) InstrString ¶
func (d DispatchInstr) InstrString() string
type EnvToStackInstr ¶
type EnvToStackInstr struct {
// contains filtered or unexported fields
}
func (EnvToStackInstr) Execute ¶
func (g EnvToStackInstr) Execute(env *Zlisp) error
func (EnvToStackInstr) InstrString ¶
func (g EnvToStackInstr) InstrString() string
type Event ¶
type Event struct { Id int `json:"id" msg:"id"` User Person `json:"user" msg:"user"` Flight string `json:"flight" msg:"flight"` Pilot []string `json:"pilot" msg:"pilot"` Cancelled bool `json:"cancelled" msg:"cancelled"` }
func (*Event) DisplayEvent ¶
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type ExplodeInstr ¶
type ExplodeInstr int
func (ExplodeInstr) Execute ¶
func (e ExplodeInstr) Execute(env *Zlisp) error
func (ExplodeInstr) InstrString ¶
func (e ExplodeInstr) InstrString() string
type Generator ¶
type Generator struct { Tail bool // contains filtered or unexported fields }
func NewGenerator ¶
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) GenerateAssignment ¶
func (*Generator) GenerateBegin ¶
func (*Generator) GenerateBreak ¶
func (*Generator) GenerateBuilder ¶
func (*Generator) GenerateCall ¶
func (*Generator) GenerateCallBySymbol ¶
func (gen *Generator) GenerateCallBySymbol(sym *SexpSymbol, args []Sexp, orig Sexp) error
func (*Generator) GenerateCond ¶
func (*Generator) GenerateContinue ¶
func (*Generator) GenerateDebug ¶
func (*Generator) GenerateDefmac ¶
func (*Generator) GenerateDispatch ¶
func (*Generator) GenerateForLoop ¶
for loops: Just like in C.
(for {optional-label} [init predicate advance] (expr)*)
Each of init, predicate, and advance are expressions that are evaluated during the running of the for loop. The init expression is evaluated once at the top. The predicate is tested. If it is true then the body expressions are run. Then the advance expression is evaluated, and we return to the predicate test.
func (*Generator) GenerateInclude ¶
func (*Generator) GenerateMacexpand ¶
func (*Generator) GenerateMultiDef ¶
(mdef a b c (list 1 2 3)) will bind a:1 b:2 c:3
func (*Generator) GenerateNewScope ¶
like begin, but puts its contents in a new scope
func (*Generator) GeneratePackage ¶
func (*Generator) GenerateQuote ¶
func (*Generator) GenerateReturn ¶
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 GoStructRegistryType ¶
type GoStructRegistryType struct { // comprehensive Registry map[string]*RegisteredType // only init-time builtins Builtin map[string]*RegisteredType // later, user-defined types Userdef map[string]*RegisteredType }
the registry type
var GoStructRegistry GoStructRegistryType
The Go Type Registry ====================
simply decide upon a name, and add a maker function for that returns a pointer to your struct. The simply add to the init() function below.
The env parameter to your MakeGoStructFunc() function is there is case you want to initialize your struct differently depending on the content of its context, but this is not commonly needed. Also, the factory method *must* support the env parameter being nil and still return a sensible, usable value. The factory will be called with env = nil during init() time.
The repl will automatically do a (defmap record) for each record defined in the registry. e.g. for snoopy, hornet, hellcat, etc.
func (*GoStructRegistryType) GetOrCreatePointerType ¶
func (gsr *GoStructRegistryType) GetOrCreatePointerType(pointedToType *RegisteredType) *RegisteredType
func (*GoStructRegistryType) GetOrCreateSliceType ¶
func (gsr *GoStructRegistryType) GetOrCreateSliceType(rt *RegisteredType) *RegisteredType
func (*GoStructRegistryType) Lookup ¶
func (r *GoStructRegistryType) Lookup(name string) *RegisteredType
func (*GoStructRegistryType) RegisterBuiltin ¶
func (r *GoStructRegistryType) RegisterBuiltin(name string, e *RegisteredType)
func (*GoStructRegistryType) RegisterPointer ¶
func (r *GoStructRegistryType) RegisterPointer(pointedToName string, pointedToType *RegisteredType) *RegisteredType
func (*GoStructRegistryType) RegisterUserdef ¶
func (r *GoStructRegistryType) RegisterUserdef( e *RegisteredType, hasShadowStruct bool, names ...string)
type GotoInstr ¶
type GotoInstr struct {
// contains filtered or unexported fields
}
func (GotoInstr) InstrString ¶
type HashFieldDet ¶
type HashizeInstr ¶
func (HashizeInstr) Execute ¶
func (s HashizeInstr) Execute(env *Zlisp) error
func (HashizeInstr) InstrString ¶
func (s HashizeInstr) InstrString() string
type InfixOp ¶
type InfixOp struct { Sym *SexpSymbol Bp int // binding power, aka precedence level. MunchRight RightMuncher // aka nud MunchLeft LeftMuncher // aka led MunchStmt StmtMuncher // aka std. Used only at the beginning of a statement. IsAssign bool }
InfixOp lets us attach led (MunchLeft) and nud (MunchRight) Pratt parsing methods, along with a binding power, to a symbol.
type Instruction ¶
type JumpInstr ¶
type JumpInstr struct {
// contains filtered or unexported fields
}
func (JumpInstr) InstrString ¶
type LabelInstr ¶
type LabelInstr struct {
// contains filtered or unexported fields
}
func (LabelInstr) Execute ¶
func (s LabelInstr) Execute(env *Zlisp) error
func (LabelInstr) InstrString ¶
func (s LabelInstr) InstrString() string
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) AddNextStream ¶
func (lex *Lexer) AddNextStream(s io.RuneScanner)
func (*Lexer) AppendToken ¶
func (*Lexer) DecodeBrace ¶
func (*Lexer) EmptyToken ¶
func (*Lexer) GetNextToken ¶
func (*Lexer) LexNextRune ¶
func (*Lexer) PeekNextToken ¶
func (*Lexer) PrependToken ¶
func (*Lexer) PromoteNextStream ¶
type LexerState ¶
type LexerState int
const ( LexerNormal LexerState = iota LexerCommentLine // LexerStrLit // LexerStrEscaped // LexerUnquote // LexerBacktickString // LexerFreshAssignOrColon LexerFirstFwdSlash // could be start of // comment or /* LexerCommentBlock LexerCommentBlockAsterisk // could be end of block comment */ LexerBuiltinOperator )
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
func (*Loop) IsStackElem ¶
func (loop *Loop) IsStackElem()
type LoopStartInstr ¶
type LoopStartInstr struct {
// contains filtered or unexported fields
}
func (LoopStartInstr) Execute ¶
func (s LoopStartInstr) Execute(env *Zlisp) error
func (LoopStartInstr) InstrString ¶
func (s LoopStartInstr) InstrString() string
type MakeGoStructFunc ¶
type NestInner ¶
type NestInner struct {
Hello string `msg:"hello" json:"hello" zid:"0"`
}
func (NestInner) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type NestOuter ¶
type NestOuter struct {
Inner *NestInner `msg:"inner" json:"inner" zid:"0"`
}
the pointer wasn't getting followed.
func (*NestOuter) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Parser ¶
type Parser struct { Done chan bool AddInput chan io.RuneScanner ReqReset chan io.RuneScanner ParsedOutput chan []ParserReply FlagSendNeedInput bool // contains filtered or unexported fields }
func (*Parser) GetMoreInput ¶
This function should *return* when it has more input for the parser/lexer, which will call it when they get wedged.
Listeners on p.ParsedOutput should know the Convention: sending a length 0 []ParserReply on p.ParsedOutput channel means: we need more input! They should send some in on p.AddInput channel; or request a reset and simultaneously give us new input with p.ReqReset channel.
func (*Parser) HaveStuffToSend ¶
func (p *Parser) HaveStuffToSend() chan []ParserReply
func (*Parser) NewInput ¶
func (p *Parser) NewInput(s io.RuneScanner)
func (*Parser) ParseBlockComment ¶
func (*Parser) ParseExpression ¶
func (*Parser) ParseTokens ¶
ParseTokens is the main service the Parser provides. Currently returns first error encountered, ignoring any expressions after that.
func (*Parser) ResetAddNewInput ¶
func (p *Parser) ResetAddNewInput(s io.RuneScanner)
type ParserReply ¶
type Person ¶
func (Person) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Plane ¶
type Plane struct { Wings ID int `json:"id" msg:"id"` Speed int `json:"speed" msg:"speed"` Chld Flyer `json:"chld" msg:"chld"` Friends []Flyer `json:"friends"` }
the interface Flyer confounds the msgp msgpack code generator, so put the msgp:ignore Plane above
type PopScopeTransferToDataStackInstr ¶
type PopScopeTransferToDataStackInstr struct {
PackageName string
}
PopScopeTransferToDataStackInstr is used to wrap up a package and put it on the data stack as a value.
func (PopScopeTransferToDataStackInstr) Execute ¶
func (a PopScopeTransferToDataStackInstr) Execute(env *Zlisp) error
func (PopScopeTransferToDataStackInstr) InstrString ¶
func (a PopScopeTransferToDataStackInstr) InstrString() string
type PopStackPutEnvInstr ¶
type PopStackPutEnvInstr struct {
// contains filtered or unexported fields
}
func (PopStackPutEnvInstr) Execute ¶
func (p PopStackPutEnvInstr) Execute(env *Zlisp) error
func (PopStackPutEnvInstr) InstrString ¶
func (p PopStackPutEnvInstr) InstrString() string
type PopUntilStackmarkInstr ¶
type PopUntilStackmarkInstr struct {
// contains filtered or unexported fields
}
cleanup until our stackmark, but leave it in place
func (PopUntilStackmarkInstr) Execute ¶
func (s PopUntilStackmarkInstr) Execute(env *Zlisp) error
func (PopUntilStackmarkInstr) InstrString ¶
func (s PopUntilStackmarkInstr) InstrString() string
type Pratt ¶
func (*Pratt) ShowCnodeStack ¶
func (p *Pratt) ShowCnodeStack()
type PrintState ¶
PrintState threads the state of display through SexpString() and Show() calls, to give pretty-printing indentation and to avoid infinite looping on cyclic data structures.
func NewPrintState ¶
func NewPrintState() *PrintState
func NewPrintStateWithIndent ¶
func NewPrintStateWithIndent(indent int) *PrintState
func (*PrintState) AddIndent ¶
func (ps *PrintState) AddIndent(addme int) *PrintState
func (*PrintState) Clear ¶
func (ps *PrintState) Clear()
func (*PrintState) Dump ¶
func (ps *PrintState) Dump()
func (*PrintState) GetIndent ¶
func (ps *PrintState) GetIndent() int
func (*PrintState) GetSeen ¶
func (ps *PrintState) GetSeen(x interface{}) bool
func (*PrintState) SetSeen ¶
func (ps *PrintState) SetSeen(x interface{}, name string)
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
func NewPrompter ¶
type PushInstr ¶
type PushInstr struct {
// contains filtered or unexported fields
}
func (PushInstr) InstrString ¶
type PushStackmarkInstr ¶
type PushStackmarkInstr struct {
// contains filtered or unexported fields
}
create a stack mark
func (PushStackmarkInstr) Execute ¶
func (s PushStackmarkInstr) Execute(env *Zlisp) error
func (PushStackmarkInstr) InstrString ¶
func (s PushStackmarkInstr) InstrString() string
type RecordDefn ¶
type RecordDefn struct { Name string Fields []*SexpField FieldType map[string]*RegisteredType }
func NewRecordDefn ¶
func NewRecordDefn() *RecordDefn
func (*RecordDefn) SetFields ¶
func (r *RecordDefn) SetFields(flds []*SexpField)
func (*RecordDefn) SetName ¶
func (r *RecordDefn) SetName(name string)
func (*RecordDefn) SexpString ¶
func (p *RecordDefn) SexpString(ps *PrintState) string
pretty print a struct
func (*RecordDefn) Type ¶
func (p *RecordDefn) Type() *RegisteredType
type RegisteredType ¶
type RegisteredType struct { Constructor *SexpFunction RegisteredName string Factory MakeGoStructFunc GenDefMap bool ValueCache reflect.Value TypeCache reflect.Type PointerName string ReflectName string IsUser bool Aliases map[string]bool DisplayAs string UserStructDefn *RecordDefn IsPointer bool // contains filtered or unexported fields }
var ArraySelectorRT *RegisteredType
var BoolRT *RegisteredType
var ClosureRT *RegisteredType
var ErrorRT *RegisteredType
var Float64RT *RegisteredType
var Int64RT *RegisteredType
var NullRT *RegisteredType
var PairRT *RegisteredType
var RawRT *RegisteredType
var ReflectRT *RegisteredType
var RuneRT *RegisteredType
var SentinelRT *RegisteredType
func NewRegisteredType ¶
func NewRegisteredType(f MakeGoStructFunc) *RegisteredType
func (*RegisteredType) Init ¶
func (e *RegisteredType) Init()
func (*RegisteredType) SexpString ¶
func (p *RegisteredType) SexpString(ps *PrintState) string
func (*RegisteredType) ShortName ¶
func (p *RegisteredType) ShortName() string
func (*RegisteredType) Type ¶
func (r *RegisteredType) Type() *RegisteredType
func (*RegisteredType) TypeCheckRecord ¶
func (p *RegisteredType) TypeCheckRecord(hash *SexpHash) error
type RemoveScopeInstr ¶
type RemoveScopeInstr struct{}
func (RemoveScopeInstr) Execute ¶
func (a RemoveScopeInstr) Execute(env *Zlisp) 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 *Zlisp) error
func (ReturnInstr) InstrString ¶
func (r ReturnInstr) InstrString() string
type Scope ¶
type Scope struct { Map map[int]Sexp IsGlobal bool Name string PackageName string Parent *Scope IsFunction bool // if true, read-only. MyFunction *SexpFunction // so we can query captured closure scopes. IsPackage bool // contains filtered or unexported fields }
Scopes map names to values. Scope nesting avoids variable name collisions and allows namespace maintainance. Most scopes (inside loops, inside functions) are implicitly created. Packages are scopes that the user can manipulate explicitly.
func (*Scope) CloneScope ¶
func (*Scope) DeleteSymbolInScope ¶
func (scope *Scope) DeleteSymbolInScope(sym *SexpSymbol) error
func (Scope) IsStackElem ¶
func (s Scope) IsStackElem()
func (*Scope) SexpString ¶
func (s *Scope) SexpString(ps *PrintState) string
SexpString satisfies the Sexp interface, producing a string presentation of the value.
func (*Scope) Type ¶
func (s *Scope) Type() *RegisteredType
Type() satisfies the Sexp interface, returning the type of the value.
func (*Scope) UpdateSymbolInScope ¶
func (scope *Scope) UpdateSymbolInScope(sym *SexpSymbol, expr Sexp) error
used to implement (set v 10)
type Seen ¶
type Seen map[interface{}]struct{}
Seen tracks if a value has already been displayed, to detect and avoid cycles.
Q: How to do garbage-collection safe graph traversal in a graph of Go objects?
A: "Instead of converting the pointer to a uintptr, just store the pointer itself in a map[interface{}]bool. If you encounter the same pointer again, you will get the same map entry. The GC must guarantee that using pointers as map keys will work even if the pointers move."
- Ian Lance Taylor on golang-nuts (2016 June 20).
type Selector ¶
type Selector interface { // RHS (right-hand-side) is used to dereference // the pointer-like Selector, yielding a value suitable for the // right-hand-side of an assignment statement. // RHS(env *Zlisp) (Sexp, error) // AssignToSelection sets the selection to rhs // The selected elements are the left-hand-side of the // assignment *lhs = rhs AssignToSelection(env *Zlisp, rhs Sexp) error }
Selector stores indexing information that isn't yet materialized for getting or setting.
type SetOfPlanes ¶
type SetOfPlanes struct {
Flyers []Flyer `json:"flyers" msg:"flyers"`
}
type Sexp ¶
type Sexp interface { // SexpString: produce a string from our value. // Single-line strings can ignore indent. // Only multiline strings should follow every // newline with at least indent worth of spaces. SexpString(ps *PrintState) string // Type returns the type of the value. Type() *RegisteredType }
Sexp is the central interface for all S-expressions (Symbol expressions ala lisp).
func ArrayAccessFunction ¶
func ArrayIndexFunction ¶
(arrayidx ar [0 1])
func ArrayOfFunction ¶
generate fixed size array
func AsTmFunction ¶
string -> time.Time
func AssignmentFunction ¶
the assignment function, =
func CallGoMethodFunction ¶
Using reflection, invoke a Go method on a struct or interface. args[0] is a hash with an an attached GoStruct args[1] is a hash representing a method call on that struct. The returned Sexp is a hash that represents the result of that call.
func ColonAccessBuilder ¶
func CommaBuilder ¶
CommaBuilder turns expressions on the LHS and RHS like {a,b,c = 1,2,3} into arrays (set [a b c] [1 2 3])
func ComplementFunction ¶
func ConstructorFunction ¶
func CreateGoroutineMacro ¶
func DefinedFunction ¶
check is a symbol/string/value is defined
func DemoNestInnerOuterFunction ¶
constructor
func DerefFunction ¶
func DotFunction ¶
"." dot operator
func DumpClosureEnvFunction ¶
_closdump : show the closed over env attached to an *SexpFunction
func EvalFunction ¶
EvalFunction: new version doesn't use a duplicated environment, allowing eval to create closures under the lexical scope and to allow proper scoping in a package.
func ExpectErrorBuilder ¶
func FlattenToWordsFunction ¶
given strings/lists of strings with possible whitespace flatten out to a array of SexpStr with no internal whitespace, suitable for passing along to (system) / exec.Command()
func GenericAccessFunction ¶
handles arrays or hashes
func GenericHpairFunction ¶
works over hashes and arrays
func GoFieldListFunction ¶
func GoMethodListFunction ¶
func HashAccessFunction ¶
func HashIndexFunction ¶
(arrayidx ar [0 1]) refers here
func ImportPackageBuilder ¶
import a package, analagous to Golang.
func JsonFunction ¶
Conversion map Go map[string]interface{} <--(1)--> lisp ^ ^ | | / | (2) ------------ (4) -----------/ (5) | / | V V V msgpack <--(3)--> go struct, strongly typed
(1) we provide these herein; see jsonmsgp_test.go too.
(a) SexpToGo() (b) GoToSexp()
(2) provided by ugorji/go/codec; see examples also herein
(a) MsgpackToGo() / JsonToGo() (b) GoToMsgpack() / GoToJson()
(3) provided by tinylib/msgp, and by ugorji/go/codec
by using pre-compiled or just decoding into an instance of the struct.
(4) see herein
(a) SexpToMsgpack() and SexpToJson() (b) MsgpackToSexp(); uses (4) = (2) + (1)
(5) The SexpToGoStructs() and ToGoFunction() in this
file provide the capability of marshaling an s-expression to a Go-struct that has been registered to be associated with a named hash map using (defmap). See repl/gotypereg.go to add your Go-struct constructor. From the prompt, the (togo) function instantiates a 'shadow' Go-struct whose data matches that configured in the record.
func JsonToSexp ¶
json -> sexp. env is needed to handle symbols correctly
func ListToArray ¶
func MsgpackMapMacro ¶
declare a new record type
func NumericFloatDo ¶
func NumericIntDo ¶
func QuoteListFunction ¶
'(a b c) -> ('a 'b 'c)
func RawToStringFunction ¶
func SetPrettyPrintFlag ¶
func SimpleSourceFunction ¶
alternative. simpler, currently panics.
func SlurpfileFunction ¶
read new-line delimited text from a file into an array (slurpf "path-to-file")
func SourceFileFunction ¶
func SplitStringFunction ¶
SplitStringFunction splits a string based on an arbitrary delimiter
func SplitStringOnNewlinesFunction ¶
(nsplit "a\nb") -> ["a" "b"]
func StartGoroutineFunction ¶
func StringUtilFunction ¶
func SystemBuilder ¶
sys is a builder. shell out, return the combined output.
func WriteShadowGreenpackToFileFunction ¶
(bsave value path) writes value as greenpack to file.
(greenpack value) writes value as greenpack to SexpRaw in memory.
bsave converts to binary with (togo) then saves the binary to file.
func WriteToFileFunction ¶
(writef <content> path); (write path) is the macro version. (owritef <content> path): write an array of strings out to the named file, overwriting it in the process. (owrite) is the macro version. save is the same as write.
type SexpArray ¶
type SexpArray struct { Val []Sexp Typ *RegisteredType IsFuncDeclTypeArray bool Infix bool Env *Zlisp }
func (*SexpArray) IndexBy ¶
IndexBy subsets one array (possibly multidimensional) by another. e.g. if arr is [a b c] and idx is [0], we'll return a.
func (*SexpArray) SexpString ¶
func (arr *SexpArray) SexpString(ps *PrintState) string
func (*SexpArray) Type ¶
func (r *SexpArray) Type() *RegisteredType
type SexpArraySelector ¶
SexpSelector: select a subset of an array: can be multidimensional index/slice and hence know its container and its position(s), and thus be able to read and write that position as need be.
func (*SexpArraySelector) AssignToSelection ¶
func (x *SexpArraySelector) AssignToSelection(env *Zlisp, rhs Sexp) error
func (*SexpArraySelector) RHS ¶
func (x *SexpArraySelector) RHS(env *Zlisp) (Sexp, error)
RHS applies the selector to the contain and returns the value obtained.
func (*SexpArraySelector) SexpString ¶
func (si *SexpArraySelector) SexpString(ps *PrintState) string
func (*SexpArraySelector) Type ¶
func (si *SexpArraySelector) Type() *RegisteredType
Type returns the type of the value.
type SexpBool ¶
type SexpBool struct { Val bool Typ *RegisteredType }
func (*SexpBool) SexpString ¶
func (b *SexpBool) SexpString(ps *PrintState) string
func (*SexpBool) Type ¶
func (r *SexpBool) Type() *RegisteredType
type SexpChannel ¶
type SexpChannel struct { Val chan Sexp Typ *RegisteredType }
func (*SexpChannel) SexpString ¶
func (ch *SexpChannel) SexpString(ps *PrintState) string
func (*SexpChannel) Type ¶
func (ch *SexpChannel) Type() *RegisteredType
type SexpChar ¶
type SexpChar struct { Val rune Typ *RegisteredType }
func (*SexpChar) SexpString ¶
func (c *SexpChar) SexpString(ps *PrintState) string
func (*SexpChar) Type ¶
func (r *SexpChar) Type() *RegisteredType
type SexpClosureEnv ¶
type SexpClosureEnv Scope
func (*SexpClosureEnv) SexpString ¶
func (c *SexpClosureEnv) SexpString(ps *PrintState) string
func (*SexpClosureEnv) Type ¶
func (r *SexpClosureEnv) Type() *RegisteredType
type SexpComma ¶
type SexpComma struct{}
func (*SexpComma) SexpString ¶
func (s *SexpComma) SexpString(ps *PrintState) string
func (*SexpComma) Type ¶
func (r *SexpComma) Type() *RegisteredType
type SexpComment ¶
func (*SexpComment) SexpString ¶
func (p *SexpComment) SexpString(ps *PrintState) string
func (*SexpComment) Type ¶
func (p *SexpComment) Type() *RegisteredType
type SexpError ¶
type SexpError struct {
// contains filtered or unexported fields
}
func (*SexpError) SexpString ¶
func (e *SexpError) SexpString(ps *PrintState) string
func (*SexpError) Type ¶
func (r *SexpError) Type() *RegisteredType
type SexpField ¶
type SexpField SexpHash
func (*SexpField) AlignString ¶
func (*SexpField) FieldWidths ¶
compute key and value widths to assist alignment
func (*SexpField) SexpString ¶
func (f *SexpField) SexpString(ps *PrintState) string
func (SexpField) Type ¶
func (r SexpField) Type() *RegisteredType
type SexpFloat ¶
type SexpFloat struct { Val float64 Typ *RegisteredType }
func (*SexpFloat) SexpString ¶
func (f *SexpFloat) SexpString(ps *PrintState) string
func (*SexpFloat) Type ¶
func (r *SexpFloat) Type() *RegisteredType
type SexpFunction ¶
type SexpFunction struct {
// contains filtered or unexported fields
}
SexpFunction
func MakeBuilderFunction ¶
func MakeBuilderFunction(name string, ufun ZlispUserFunction) *SexpFunction
func MakeUserFunction ¶
func MakeUserFunction(name string, ufun ZlispUserFunction) *SexpFunction
func (*SexpFunction) ClosingLookupSymbol ¶
func (sf *SexpFunction) ClosingLookupSymbol(sym *SexpSymbol, setVal *Sexp) (Sexp, error, *Scope)
func (*SexpFunction) ClosingLookupSymbolUntilFunction ¶
func (sf *SexpFunction) ClosingLookupSymbolUntilFunction(sym *SexpSymbol) (Sexp, error, *Scope)
func (*SexpFunction) Copy ¶
func (sf *SexpFunction) Copy() *SexpFunction
func (*SexpFunction) SetClosing ¶
func (sf *SexpFunction) SetClosing(clos *Closing)
func (*SexpFunction) SexpString ¶
func (sf *SexpFunction) SexpString(ps *PrintState) string
func (*SexpFunction) ShowClosing ¶
func (sf *SexpFunction) ShowClosing(env *Zlisp, ps *PrintState, label string) (string, error)
func (*SexpFunction) Type ¶
func (sf *SexpFunction) Type() *RegisteredType
type SexpGoroutine ¶
type SexpGoroutine struct {
// contains filtered or unexported fields
}
func (*SexpGoroutine) SexpString ¶
func (goro *SexpGoroutine) SexpString(ps *PrintState) string
func (*SexpGoroutine) Type ¶
func (goro *SexpGoroutine) Type() *RegisteredType
type SexpHash ¶
type SexpHash struct { TypeName string Map map[int][]*SexpPair KeyOrder []Sexp GoStructFactory *RegisteredType NumKeys int GoMethods []reflect.Method GoFields []reflect.StructField GoMethSx SexpArray GoFieldSx SexpArray GoType reflect.Type NumMethod int GoShadowStruct interface{} GoShadowStructVa reflect.Value ShadowSet bool // json tag name -> pointers to example values, as factories for SexpToGoStructs() JsonTagMap map[string]*HashFieldDet DetOrder []*HashFieldDet // for using these as a scoping model DefnEnv *SexpHash SuperClass *SexpHash ZMain SexpFunction ZMethods map[string]*SexpFunction Env *Zlisp }
func GetFuncArgArray ¶
func (*SexpHash) BindSymbol ¶
func (h *SexpHash) BindSymbol(key *SexpSymbol, val Sexp) error
func (*SexpHash) CloneFrom ¶
CloneFrom copys all the internals of src into p, effectively blanking out whatever p held and replacing it with a copy of src.
func (*SexpHash) DotPathHashGet ¶
func (h *SexpHash) DotPathHashGet(env *Zlisp, sym *SexpSymbol) (Sexp, error)
func (*SexpHash) FillHashFromShadow ¶
func (*SexpHash) HashDelete ¶
func (*SexpHash) HashGetDefault ¶
func (*SexpHash) NewSexpHashSelector ¶
func (h *SexpHash) NewSexpHashSelector(sym *SexpSymbol) *SexpHashSelector
func (*SexpHash) RunZmethod ¶
func (*SexpHash) SetDefnEnv ¶
func (*SexpHash) SetGoStructFactory ¶
func (h *SexpHash) SetGoStructFactory(factory *RegisteredType)
func (*SexpHash) SetMain ¶
func (h *SexpHash) SetMain(p *SexpFunction)
func (*SexpHash) SetMethodList ¶
func (*SexpHash) SexpString ¶
func (hash *SexpHash) SexpString(ps *PrintState) string
func (*SexpHash) Type ¶
func (r *SexpHash) Type() *RegisteredType
type SexpHashSelector ¶
SexpHashSelector: reference to a symbol in a hash table.
func (*SexpHashSelector) AssignToSelection ¶
func (x *SexpHashSelector) AssignToSelection(env *Zlisp, rhs Sexp) error
func (*SexpHashSelector) RHS ¶
func (x *SexpHashSelector) RHS(env *Zlisp) (sx Sexp, err error)
RHS applies the selector to the contain and returns the value obtained.
func (*SexpHashSelector) SexpString ¶
func (si *SexpHashSelector) SexpString(ps *PrintState) string
func (*SexpHashSelector) Type ¶
func (si *SexpHashSelector) Type() *RegisteredType
Type returns the type of the value.
type SexpInt ¶
type SexpInt struct { Val int64 Typ *RegisteredType }
func (*SexpInt) SexpString ¶
func (i *SexpInt) SexpString(ps *PrintState) string
func (*SexpInt) Type ¶
func (r *SexpInt) Type() *RegisteredType
type SexpInterfaceDecl ¶
type SexpInterfaceDecl struct {
// contains filtered or unexported fields
}
SexpInterfaceDecl
func (*SexpInterfaceDecl) SexpString ¶
func (r *SexpInterfaceDecl) SexpString(ps *PrintState) string
func (*SexpInterfaceDecl) Type ¶
func (r *SexpInterfaceDecl) Type() *RegisteredType
type SexpPair ¶
func (*SexpPair) SexpString ¶
func (pair *SexpPair) SexpString(ps *PrintState) string
func (*SexpPair) Type ¶
func (r *SexpPair) Type() *RegisteredType
type SexpPointer ¶
type SexpPointer struct { ReflectTarget reflect.Value Target Sexp PointedToType *RegisteredType MyType *RegisteredType }
func NewSexpPointer ¶
func NewSexpPointer(pointedTo Sexp) *SexpPointer
func (*SexpPointer) SexpString ¶
func (p *SexpPointer) SexpString(ps *PrintState) string
func (*SexpPointer) Type ¶
func (p *SexpPointer) Type() *RegisteredType
type SexpRaw ¶
type SexpRaw struct { Val []byte Typ *RegisteredType }
func (*SexpRaw) SexpString ¶
func (r *SexpRaw) SexpString(ps *PrintState) string
func (*SexpRaw) Type ¶
func (r *SexpRaw) Type() *RegisteredType
type SexpReflect ¶
func (*SexpReflect) SexpString ¶
func (r *SexpReflect) SexpString(ps *PrintState) string
func (*SexpReflect) Type ¶
func (r *SexpReflect) Type() *RegisteredType
type SexpRegexp ¶
func (*SexpRegexp) SexpString ¶
func (re *SexpRegexp) SexpString(ps *PrintState) string
func (*SexpRegexp) Type ¶
func (r *SexpRegexp) Type() *RegisteredType
type SexpSemicolon ¶
type SexpSemicolon struct{}
func (*SexpSemicolon) SexpString ¶
func (s *SexpSemicolon) SexpString(ps *PrintState) string
func (*SexpSemicolon) Type ¶
func (r *SexpSemicolon) Type() *RegisteredType
type SexpSentinel ¶
type SexpSentinel struct {
Val int
}
func (*SexpSentinel) SexpString ¶
func (sent *SexpSentinel) SexpString(ps *PrintState) string
func (*SexpSentinel) Type ¶
func (r *SexpSentinel) Type() *RegisteredType
type SexpStackmark ¶
type SexpStackmark struct {
// contains filtered or unexported fields
}
func (*SexpStackmark) SexpString ¶
func (mark *SexpStackmark) SexpString(ps *PrintState) string
func (*SexpStackmark) Type ¶
func (r *SexpStackmark) Type() *RegisteredType
type SexpStr ¶
type SexpStr struct { S string Typ *RegisteredType // contains filtered or unexported fields }
func (*SexpStr) SexpString ¶
func (s *SexpStr) SexpString(ps *PrintState) string
func (SexpStr) Type ¶
func (r SexpStr) Type() *RegisteredType
type SexpSymbol ¶
type SexpSymbol struct {
// contains filtered or unexported fields
}
func (*SexpSymbol) AssignToSelection ¶
func (sym *SexpSymbol) AssignToSelection(env *Zlisp, rhs Sexp) error
func (SexpSymbol) Name ¶
func (sym SexpSymbol) Name() string
func (SexpSymbol) Number ¶
func (sym SexpSymbol) Number() int
func (*SexpSymbol) SexpString ¶
func (sym *SexpSymbol) SexpString(ps *PrintState) string
func (*SexpSymbol) Type ¶
func (r *SexpSymbol) Type() *RegisteredType
type SexpTime ¶
func (*SexpTime) SexpString ¶
func (t *SexpTime) SexpString(ps *PrintState) string
func (*SexpTime) Type ¶
func (r *SexpTime) Type() *RegisteredType
type SexpUserVarDefn ¶
type SexpUserVarDefn struct {
Name string
}
type ShortNamer ¶
type ShortNamer interface {
ShortName() string
}
type Showable ¶
type Showable interface {
Show(env *Zlisp, ps *PrintState, label string) (string, error)
}
type Snoopy ¶
type Snoopy struct { Plane `json:"plane" msg:"plane"` Cry string `json:"cry" msg:"cry"` Pack []int `json:"pack"` Carrying []Flyer `json:"carrying"` }
func (*Snoopy) EchoWeather ¶
func (*Snoopy) Sideeffect ¶
func (p *Snoopy) Sideeffect()
type SquashInstr ¶
type SquashInstr int
func (SquashInstr) Execute ¶
func (s SquashInstr) Execute(env *Zlisp) error
func (SquashInstr) InstrString ¶
func (s SquashInstr) InstrString() string
type Stack ¶
type Stack struct { Name string // type name // package support: PackageName string IsPackage bool // contains filtered or unexported fields }
func (*Stack) BindSymbol ¶
func (stack *Stack) BindSymbol(sym *SexpSymbol, expr Sexp) error
func (*Stack) DeleteSymbolFromTopOfStackScope ¶
func (stack *Stack) DeleteSymbolFromTopOfStackScope(sym *SexpSymbol) error
func (*Stack) IsStackElem ¶
func (stack *Stack) IsStackElem()
func (*Stack) LookupSymbol ¶
func (*Stack) LookupSymbolNonGlobal ¶
func (stack *Stack) LookupSymbolNonGlobal(sym *SexpSymbol) (Sexp, error, *Scope)
LookupSymbolNonGlobal - closures use this to only find symbols below the global scope, to avoid copying globals it'll always be-able to ref
func (*Stack) LookupSymbolUntilFunction ¶
lookup symbols, but don't go beyond a function boundary -- a user-defined function boundary that is. We certainly have to go up beyond all built-in operators like '+' and '-', '*' and '/'.
func (*Stack) PrintScopeStack ¶
func (stack *Stack) PrintScopeStack()
func (*Stack) PrintStack ¶
func (stack *Stack) PrintStack()
func (*Stack) PushAddr ¶
func (stack *Stack) PushAddr(function *SexpFunction, pc int)
func (*Stack) PushExpressions ¶
func (*Stack) SexpString ¶
func (s *Stack) SexpString(ps *PrintState) string
func (*Stack) TruncateToSize ¶
set newsize to 0 to truncate everything
func (*Stack) Type ¶
func (s *Stack) Type() *RegisteredType
Type() satisfies the Sexp interface, returning the type of the value.
type SymtabSorter ¶
type SymtabSorter []*SymtabE
func (SymtabSorter) Len ¶
func (a SymtabSorter) Len() int
func (SymtabSorter) Less ¶
func (a SymtabSorter) Less(i, j int) bool
func (SymtabSorter) Swap ¶
func (a SymtabSorter) Swap(i, j int)
type TokenType ¶
type TokenType int
const ( TokenTypeEmpty TokenType = iota TokenLParen TokenRParen TokenLSquare TokenRSquare TokenLCurly TokenRCurly TokenDot TokenQuote TokenBacktick TokenTilde TokenTildeAt TokenSymbol TokenBool TokenDecimal TokenHex TokenOct TokenBinary TokenFloat TokenChar TokenString TokenCaret TokenColonOperator TokenThreadingOperator TokenBackslash TokenDollar TokenDotSymbol TokenFreshAssign TokenBacktickString TokenComment TokenBeginBlockComment TokenEndBlockComment TokenSemicolon TokenSymbolColon TokenComma TokenEnd )
type TypeCheckable ¶
type TypeCheckable interface {
TypeCheck() error
}
type UpdateInstr ¶
type UpdateInstr struct {
// contains filtered or unexported fields
}
Update takes top of datastack and assigns it to sym when sym is found already in the current scope or up the stack. Used to implement (set v 10) when v is not in the local scope.
func (UpdateInstr) Execute ¶
func (p UpdateInstr) Execute(env *Zlisp) error
func (UpdateInstr) InstrString ¶
func (p UpdateInstr) InstrString() string
type VectorizeInstr ¶
type VectorizeInstr int
func (VectorizeInstr) Execute ¶
func (s VectorizeInstr) Execute(env *Zlisp) error
func (VectorizeInstr) InstrString ¶
func (s VectorizeInstr) InstrString() string
type Weather ¶
type Weather struct { Time time.Time `json:"time" msg:"time"` Size int64 `json:"size" msg:"size"` Type string `json:"type" msg:"type"` Details []byte `json:"details" msg:"details"` }
func (*Weather) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type Zlisp ¶
type Zlisp struct { Pretty bool // API use, since infix is already default at repl WrapLoadExpressionsInInfix bool // contains filtered or unexported fields }
func NewZlispSandbox ¶
func NewZlispSandbox() *Zlisp
NewZlispSandbox returns a new *Zlisp instance that does not allow the user to get to the outside world
func NewZlispWithFuncs ¶
func NewZlispWithFuncs(funcs map[string]ZlispUserFunction) *Zlisp
NewZlispWithFuncs returns a new *Zlisp instance with access to only the given builtin functions
func (*Zlisp) AddBuilder ¶
func (env *Zlisp) AddBuilder(name string, function ZlispUserFunction)
func (*Zlisp) AddFunction ¶
func (env *Zlisp) AddFunction(name string, function ZlispUserFunction)
func (*Zlisp) AddMacro ¶
func (env *Zlisp) AddMacro(name string, function ZlispUserFunction)
func (*Zlisp) AddPostHook ¶
func (*Zlisp) AddPreHook ¶
func (*Zlisp) Assignment ¶
Assignment creates a new assignment operator for infix processing.
func (*Zlisp) CallFunction ¶
func (env *Zlisp) CallFunction(function *SexpFunction, nargs int) error
func (*Zlisp) CallUserFunction ¶
func (*Zlisp) CurrentFunctionSize ¶
func (*Zlisp) DetectSigils ¶
func (env *Zlisp) DetectSigils(sym *SexpSymbol)
func (*Zlisp) DumpEnvironment ¶
func (env *Zlisp) DumpEnvironment()
func (*Zlisp) DumpFunctionByName ¶
func (*Zlisp) DumpSymTable ¶
func (env *Zlisp) DumpSymTable()
func (*Zlisp) EliminateColonAndCommaFromArgs ¶
func (*Zlisp) EvalExpressions ¶
for most things now (except the main repl), prefer EvalFunction() instead of EvalExpressions.
func (*Zlisp) FunctionCallNameTypeCheck ¶
func (env *Zlisp) FunctionCallNameTypeCheck(f *SexpFunction, nargs *int) error
FunctionCallNameTypeCheck type checks a function call.
func (*Zlisp) GenSymbol ¶
func (env *Zlisp) GenSymbol(prefix string) *SexpSymbol
func (*Zlisp) GetStackTrace ¶
func (*Zlisp) HasMacro ¶
func (env *Zlisp) HasMacro(sym *SexpSymbol) bool
func (*Zlisp) ImportBaseTypes ¶
func (env *Zlisp) ImportBaseTypes()
func (*Zlisp) ImportChannels ¶
func (env *Zlisp) ImportChannels()
func (*Zlisp) ImportDemoData ¶
func (env *Zlisp) ImportDemoData()
func (*Zlisp) ImportEval ¶
func (env *Zlisp) ImportEval()
func (*Zlisp) ImportGoroutines ¶
func (env *Zlisp) ImportGoroutines()
func (*Zlisp) ImportMsgpackMap ¶
func (env *Zlisp) ImportMsgpackMap()
func (*Zlisp) ImportPackageBuilder ¶
func (env *Zlisp) ImportPackageBuilder()
A builder is a special kind of function. Like a macro it receives the un-evaluated tree of symbols from its caller. A builder can therefore be used to build new types and declarations new functions/methods.
Like a function, a builder is called at run/evaluation time, not at definition time.
Since it receives an un-evaluated tree of symbols, a builder must manually evaluate any arguments it wishes to find bindings for.
The primary use here is to be able to define packages, structs, interfaces, functions, methods, and type aliases.
func (*Zlisp) ImportRandom ¶
func (env *Zlisp) ImportRandom()
func (*Zlisp) ImportRegex ¶
func (env *Zlisp) ImportRegex()
func (*Zlisp) ImportTime ¶
func (env *Zlisp) ImportTime()
func (*Zlisp) Infixr ¶
Infix creates a new (right-associative) short-circuiting infix operator, used for `and` and `or` in infix processing.
func (*Zlisp) InitInfixOps ¶
func (env *Zlisp) InitInfixOps()
InitInfixOps establishes the env.infixOps definitions required for infix parsing using the Pratt parser.
func (*Zlisp) IsBuiltinSym ¶
func (env *Zlisp) IsBuiltinSym(sym *SexpSymbol) (builtin bool, typ string)
func (*Zlisp) LexicalBindSymbol ¶
func (env *Zlisp) LexicalBindSymbol(sym *SexpSymbol, expr Sexp) error
func (*Zlisp) LexicalLookupSymbol ¶
func (*Zlisp) LoadExpressions ¶
func (*Zlisp) LoadStream ¶
func (env *Zlisp) LoadStream(stream io.RuneScanner) error
func (*Zlisp) LoadString ¶
func (*Zlisp) MakeDotSymbol ¶
func (env *Zlisp) MakeDotSymbol(name string) *SexpSymbol
func (*Zlisp) MakeFunction ¶
func (env *Zlisp) MakeFunction(name string, nargs int, varargs bool, fun ZlispFunction, orig Sexp) *SexpFunction
func (*Zlisp) MakeSymbol ¶
func (env *Zlisp) MakeSymbol(name string) *SexpSymbol
func (*Zlisp) NewNamedScope ¶
func (*Zlisp) NewSexpArray ¶
func (*Zlisp) PostfixAssign ¶
PostfixAssign creates a new postfix assignment operator for infix processing.
func (*Zlisp) ReachedEnd ¶
func (*Zlisp) ReplLineInfixWrap ¶
func (*Zlisp) ReturnFromFunction ¶
func (*Zlisp) SetBooter ¶
allow clients to establish a callback to happen after reinflating a Go struct. These structs need to be "booted" to be ready to go.
func (*Zlisp) ShowGlobalStack ¶
func (*Zlisp) ShowStackStackAndScopeStack ¶
func (*Zlisp) SourceExpressions ¶
SourceExpressions, this should be called from a user func context
func (*Zlisp) SourceStream ¶
func (env *Zlisp) SourceStream(stream io.RuneScanner) error
func (*Zlisp) StandardSetup ¶
func (env *Zlisp) StandardSetup()
type ZlispConfig ¶
type ZlispConfig struct { CpuProfile string MemProfile string ExitOnFailure bool CountFuncCalls bool Flags *flag.FlagSet ExtensionsVersion string Command string Sandboxed bool Quiet bool Trace bool LoadDemoStructs bool // liner bombs under emacs, avoid it with this flag. NoLiner bool Prompt string // default "zlisp> " }
configure a glisp repl
func NewZlispConfig ¶
func NewZlispConfig(cmdname string) *ZlispConfig
func (*ZlispConfig) DefineFlags ¶
func (c *ZlispConfig) DefineFlags()
call DefineFlags before myflags.Parse()
func (*ZlispConfig) ValidateConfig ¶
func (c *ZlispConfig) ValidateConfig() error
call c.ValidateConfig() after myflags.Parse()
type ZlispFunction ¶
type ZlispFunction []Instruction
Source Files ¶
- address.go
- arrayutils.go
- basetypes.go
- blake2.go
- bsave.go
- builders.go
- callgo.go
- cfg.go
- channels.go
- check.go
- closing.go
- comment.go
- comparisons.go
- coroutines.go
- datastack.go
- demo_go_structs.go
- demo_go_structs_gen.go
- depend.go
- doc.go
- environment.go
- exists.go
- expressions.go
- func.go
- functions.go
- generator.go
- gitcommit.go
- gob.go
- gotypereg.go
- hashutils.go
- import.go
- jsonmsgp.go
- lexer.go
- liner.go
- listutils.go
- makego.go
- msgpackmap.go
- numerictower.go
- panicon.go
- parser.go
- pratt.go
- printstate.go
- ptrcheck.go
- random.go
- rawutils.go
- regexp.go
- repl.go
- scopes.go
- slurp.go
- source.go
- stack.go
- strutils.go
- system.go
- time.go
- typeutils.go
- version.go
- vm.go
- vprint.go