core

package
v0.0.0-...-438179e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2024 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package core contains the high level internal function of Serene

Index

Constants

View Source
const FALSEFORM string = "false"
View Source
const NILFORM string = "nil"
View Source
const NSFORM string = "ns"
View Source
const (
	// Pop a function from the call stack. We use this
	// instruction at the end of function bodies. So
	// function bodies will clean up after themselves
	PopStack instructionType = iota
)

Instruction types

View Source
const TRUEFORM string = "true"

Variables

View Source
var BUILTINS = map[string]NativeFunction{
	"pr":      MakeNativeFn("pr", PrNativeFn),
	"prn":     MakeNativeFn("prn", PrnNativeFn),
	"print":   MakeNativeFn("print", PrintNativeFn),
	"println": MakeNativeFn("println", PrintlnNativeFn),
	"require": MakeNativeFn("require", RequireNativeFn),
	"hash":    MakeNativeFn("hash", HashNativeFn),
}

BUILTINS is used in the Runtime to support builtin functions of the language which are implemented in Go

View Source
var Nothing = NothingType{}

Functions

func Def

func Def(rt *Runtime, scope IScope, args *List) (IExpr, IError)

Def defines a global binding in the current namespace. The first arguments in `args` has to be a symbol ( none ns qualified ) and the second param should be the value of the binding

func DefMacro

func DefMacro(rt *Runtime, scope IScope, args *List) (IExpr, IError)

Def defines a macro in the current namespace. The first arguments in `args` has to be a symbol ( none ns qualified ) and the rest of params should be the body of the macro. Unlike other expressions in Serene `defmacro` DOES NOT evaluate its arguments. That is what makes macros great

func Eval

func Eval(rt *Runtime, forms *Block) (IExpr, IError)

Eval the given `Block` of code with the given runtime `rt`. The Important part here is that any expression that we need to Eval has to be wrapped in a Block. Don't confused the concept of Block with blocks from other languages which specify by using `{}` or indent or what ever. Blocks in terms of Serene are just arrays of expressions and nothing more.

func EvalForms

func EvalForms(rt *Runtime, scope IScope, expressions IExpr) (IExpr, IError)

EvalForms evaluates the given expr `expressions` (it can be a list, block, symbol or anything else) with the given runtime `rt` and the scope `scope`.

func EvalNSBody

func EvalNSBody(rt *Runtime, ns *Namespace) (*Namespace, IError)

EvalNSBody evals the body of the given namespace `ns` using the given runtime `rt`. It makes sure that the body starts with a `ns` special form with the same name as the ns argument.

func Fn

func Fn(rt *Runtime, scope IScope, args *List) (IExpr, IError)

Fn defines a function inside the given scope `scope` with the given `args`. `args` contains the argument list, docstring and body of the function.

func HashNativeFn

func HashNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func ListStartsWith

func ListStartsWith(l *List, sym string) bool

func MakeDouble

func MakeDouble(x interface{}) (*Double, IError)

func MakeFnScope

func MakeFnScope(rt *Runtime, parent IScope, bindings, values IColl) (*Scope, IError)

MakeFnScope a new scope for the body of a function. It binds the `bindings` to the given `values`.

func MakeInteger

func MakeInteger(x interface{}) (*Integer, IError)

func MakeKeyword

func MakeKeyword(n Node, name string) (*Keyword, IError)

func MakeSymbol

func MakeSymbol(n Node, s string) (*Symbol, IError)

func NSForm

func NSForm(rt *Runtime, scope IScope, args *List) (IExpr, IError)

func ParseToAST

func ParseToAST(ns string, input *string) (*Block, IError)

ParseToAST is the entry function to the reader/parser which converts the `input` string to a `Block` of code. A block by itself is not something available to the language. It's just anbstraction for a ordered collection of expressions. It doesn't have anything to do with the concept of blocks from other programming languages.

func Pr

func Pr(rt *Runtime, forms ...IRepresentable)

func PrNativeFn

func PrNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func Print

func Print(rt *Runtime, forms ...IRepresentable)

func PrintError

func PrintError(rt *Runtime, err IError)

func PrintNativeFn

func PrintNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func Println

func Println(rt *Runtime, forms ...IRepresentable)

func PrintlnNativeFn

func PrintlnNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func Prn

func Prn(rt *Runtime, forms ...IRepresentable)

func PrnNativeFn

func PrnNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func REPL

func REPL(flags map[string]bool)

REPL executes a Read Eval Print Loop locally reading from stdin and writing to stdout

func ReadBytes

func ReadBytes(ns string, input *[]byte) (*Block, IError)

func ReadString

func ReadString(ns string, input *string) (*Block, IError)

func RequireNamespace

func RequireNamespace(rt *Runtime, namespace IExpr) (IExpr, IError)

RequireNamespace finds and loads the naemspace which is addressed by the given expression `namespace` and add the loaded namespace to the list of available namespaces on the runtime and add the correct reference to the current namespace. If `namespace` is a symbol, then the name of the symbol would be used as the ns name and an alias with the same name will be added to the current namespace as the external reference. If it is a IColl (List at the moment), then the symbol in the first element would be the ns name and the second symbol will be the name of the alias to be used.

func RequireNativeFn

func RequireNativeFn(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func Run

func Run(flags map[string]bool, args []string)

Types

type Binding

type Binding struct {
	Value  IExpr
	Public bool
}

type Block

type Block struct {
	ExecutionScope
	// contains filtered or unexported fields
}

Block struct represents a group of forms. Don't confuse it with code blocks from other languages that specify a block using curly brackets and indentation. Blocks in serene are just a group of forms and nothing more.

func MakeBlock

func MakeBlock(body []IExpr) *Block

MakeBlock creates a block that holds the given array of forms `body`.

func MakeEmptyBlock

func MakeEmptyBlock() *Block

MakeEmptyBlock creates an empty block

func (*Block) Append

func (b *Block) Append(form IExpr)

Append the given expr `form` to the block

func (*Block) Count

func (b *Block) Count() int

func (*Block) GetLocation

func (b *Block) GetLocation() *ast.Location

func (*Block) GetType

func (b *Block) GetType() ast.NodeType

func (*Block) Hash

func (b *Block) Hash() uint32

func (*Block) SetContent

func (b *Block) SetContent(body []IExpr)

func (*Block) String

func (b *Block) String() string

func (*Block) ToDebugStr

func (b *Block) ToDebugStr() string

func (*Block) ToSlice

func (b *Block) ToSlice() []IExpr

type Bool

type Bool struct {
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func MakeFalse

func MakeFalse(n Node) *Bool

func MakeTrue

func MakeTrue(n Node) *Bool

func (*Bool) GetType

func (t *Bool) GetType() ast.NodeType

func (*Bool) Hash

func (t *Bool) Hash() uint32

func (*Bool) IsFalse

func (t *Bool) IsFalse() bool

func (*Bool) IsTrue

func (t *Bool) IsTrue() bool

func (*Bool) String

func (t *Bool) String() string

func (*Bool) ToDebugStr

func (t *Bool) ToDebugStr() string

type CallStack

type CallStack struct {
	// contains filtered or unexported fields
}

func MakeCallStack

func MakeCallStack(debugMode bool) CallStack

func (*CallStack) Count

func (c *CallStack) Count() uint

func (*CallStack) GetCurrentFn

func (c *CallStack) GetCurrentFn() IFn

func (*CallStack) Peek

func (c *CallStack) Peek() *Frame

func (*CallStack) Pop

func (c *CallStack) Pop() *Frame

func (*CallStack) Push

func (c *CallStack) Push(caller IExpr, f IFn) IError

func (*CallStack) ToTraceBack

func (c *CallStack) ToTraceBack() *TraceBack

type CallStackItem

type CallStackItem struct {
	// contains filtered or unexported fields
}

type Double

type Double struct {
	Node
	// contains filtered or unexported fields
}

func (*Double) F64

func (d *Double) F64() float64

func (*Double) GetExecutionScope

func (d *Double) GetExecutionScope() IScope

func (*Double) GetType

func (d *Double) GetType() ast.NodeType

func (*Double) Hash

func (d *Double) Hash() uint32

func (*Double) I64

func (d *Double) I64() int64

func (*Double) SetExecutionScope

func (d *Double) SetExecutionScope(scope IScope)

func (*Double) String

func (d *Double) String() string

func (*Double) ToDebugStr

func (d *Double) ToDebugStr() string

type ErrType

type ErrType uint8
const (
	SyntaxError ErrType = iota
	SemanticError
	RuntimeError
)

func (ErrType) String

func (e ErrType) String() string

type Error

type Error struct {
	Node

	WrappedErr error
	// contains filtered or unexported fields
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetDescription

func (e *Error) GetDescription() *string

func (*Error) GetErrType

func (e *Error) GetErrType() ErrType

func (*Error) GetErrno

func (e *Error) GetErrno() errors.Errno

func (*Error) GetStackTrace

func (e *Error) GetStackTrace() *TraceBack

func (*Error) SetNode

func (e *Error) SetNode(n *Node)

func (*Error) String

func (e *Error) String() string

func (*Error) ToDebugStr

func (e *Error) ToDebugStr() string

func (*Error) WithError

func (e *Error) WithError(err error) IError

type ExecutionScope

type ExecutionScope struct {
	// contains filtered or unexported fields
}

func (*ExecutionScope) GetExecutionScope

func (e *ExecutionScope) GetExecutionScope() IScope

func (*ExecutionScope) SetExecutionScope

func (e *ExecutionScope) SetExecutionScope(scope IScope)

type Frame

type Frame struct {
	// Number of recursive calls to this function
	Count uint

	// Function to call
	Callee IFn

	// Where is the call happening
	Caller IExpr
}

func MakeFrame

func MakeFrame(rt *Runtime, caller IExpr, f IFn, count uint) *Frame

func (*Frame) String

func (f *Frame) String() string

type Function

type Function struct {
	// Node struct holds the necessary functions to make
	// Functions locatable
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

Function struct represent a user defined function.

func MakeFunction

func MakeFunction(n Node, scope IScope, params IColl, body *Block) *Function

MakeFunction Create a function with the given `params` and `body` in the given `scope`.

func MakeMacro

func MakeMacro(scope IScope, name string, params IColl, body *Block) *Function

MakeMacro creates a macro with the given `params` and `body` in the given `scope`.

func (*Function) Apply

func (f *Function) Apply(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func (*Function) GetBody

func (f *Function) GetBody() *Block

func (*Function) GetName

func (f *Function) GetName() string

func (*Function) GetParams

func (f *Function) GetParams() IColl

func (*Function) GetScope

func (f *Function) GetScope() IScope

func (*Function) GetType

func (f *Function) GetType() ast.NodeType

func (*Function) Hash

func (f *Function) Hash() uint32

func (*Function) IsMacro

func (f *Function) IsMacro() bool

func (*Function) SetName

func (f *Function) SetName(name string)

func (*Function) String

func (f *Function) String() string

func (*Function) ToDebugStr

func (f *Function) ToDebugStr() string

type ICallStack

type ICallStack interface {
	// Push the given callable `f` to the stack
	Push(f IFn) IError
	Pop() *Frame
	Peek() *Frame
	Count() uint
}

type IColl

type IColl interface {
	ISeq
	ICountable
	ToSlice() []IExpr
	Cons(e IExpr) IExpr
}

IColl describes a collection of values. A finite collection.

type ICountable

type ICountable interface {
	Count() int
}

type IDebuggable

type IDebuggable interface {
	ToDebugStr() string
}

IDebuggable is the interface designed for converting forms to a string form which are meant to be used as debug data

type IError

type IError interface {
	// In order to point to a specific point in the input
	ast.ILocatable

	// We want errors to be printable by the `print` family
	IRepresentable
	IDebuggable

	GetErrType() ErrType
	GetErrno() errors.Errno
	GetDescription() *string
	GetStackTrace() *TraceBack
	// To wrap Golan rrrrors
	WithError(err error) IError

	// Some errors might doesn't have any node available to them
	// at the creation time. SetNode allows us to the the appropriate
	// node later in time.
	SetNode(n *Node)
}

IError defines the necessary functionality of the internal errors.

func MakeError

func MakeError(rt *Runtime, e IExpr, msg string) IError

MakeError creates an Error which points to the given IExpr `e` as the root of the error.

func MakePlainError

func MakePlainError(msg string) IError

func MakeRuntimeError

func MakeRuntimeError(rt *Runtime, e IExpr, errno errors.Errno, msg string) IError

func MakeSemanticError

func MakeSemanticError(rt *Runtime, e IExpr, errno errors.Errno, msg string) IError

func MakeSyntaxErrorf

func MakeSyntaxErrorf(n Node, msg string, a ...interface{}) IError

func ProcessInstruction

func ProcessInstruction(rt *Runtime, form *Instruction) IError

ProcessInstruction is the main function to process instructions

type IExpr

IExpr is the most important interface in Serene which basically represents a VALUE in Serene. All the forms (beside special formss) has to implement this interface.

func MakeStackPop

func MakeStackPop(rt *Runtime) IExpr

type IFn

type IFn interface {
	IExpr
	Apply(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)
	GetName() string
}

type INamespace

type INamespace interface {
	// TODO: Add a method to fetch the source code based on the source value
	DefineGlobal()
	LookupGlobal()
	GetRootScope() IScope
	// return the fully qualified name of the namespace
	GetName() string
	// contains filtered or unexported methods
}

type INumber

type INumber interface {
	IExpr
	// Int() int
	// I8() int8
	// I16() int16
	// I32() int32
	I64() int64

	// F32() float32
	F64() float64
}

func MakeNumberFromStr

func MakeNumberFromStr(n Node, strValue string, isDouble bool) (INumber, error)

type IParsable

type IParsable interface {

	// Returns the current position in the buffer
	GetLocation() int
	GetSource() *ast.Source
	Buffer() *[]string
	// contains filtered or unexported methods
}

IParsable defines the common interface which any parser has to implement.

type IPrintable

type IPrintable interface {
	IRepresentable
	PrintToString() string
}

IPrintable is the interface which any value that wants to have a string representation for printing has to implement. The `print` family functions will use this interface to convert forms to string first and if the value doesn't implement this interface they will resort to `IRepresentable`

type IRepresentable

type IRepresentable interface {
	fmt.Stringer
}

IRepresentable is the interface which any value that wants to have a string representation has to implement. Serene will use this string where ever it needs to present a value as string.

type IScopable

type IScopable interface {

	// GetExecutionScope returns an attached execution scope if there's
	// any, nil otherwise.
	GetExecutionScope() IScope

	// SetExecutionScope sets the given scope as the execution scope of
	// the current implementor
	SetExecutionScope(scope IScope)
}

IScopable is the interface describing how to get the execution scope of the value. During the evaluation of the forms in Serene we might rewrite the execution tree to eliminate tail calls. In order to do that we should be able to attach the execution scope to any form that we need to rewrite.

type IScope

type IScope interface {
	Lookup(rt *Runtime, k string) *Binding
	Insert(k string, v IExpr, public bool)
	GetNS(rt *Runtime) *Namespace
	SetNS(ns *string)
}

type ISeq

type ISeq interface {
	First() IExpr
	Rest() ISeq
}

ISeq is an interface describing a sequence of forms

type Instruction

type Instruction struct {
	// Just to be compatible with IExpr ---
	Node
	ExecutionScope

	Type instructionType
}

func (*Instruction) GetType

func (n *Instruction) GetType() ast.NodeType

func (*Instruction) Hash

func (n *Instruction) Hash() uint32

func (*Instruction) String

func (n *Instruction) String() string

func (*Instruction) ToDebugStr

func (n *Instruction) ToDebugStr() string

type Integer

type Integer struct {
	Node

	ExecutionScope
	// contains filtered or unexported fields
}

func (*Integer) F64

func (i *Integer) F64() float64

func (*Integer) GetExecutionScope

func (i *Integer) GetExecutionScope() IScope

func (*Integer) GetType

func (i *Integer) GetType() ast.NodeType

func (*Integer) Hash

func (i *Integer) Hash() uint32

func (*Integer) I64

func (i *Integer) I64() int64

func (*Integer) SetExecutionScope

func (i *Integer) SetExecutionScope(scope IScope)

func (*Integer) String

func (i *Integer) String() string

func (*Integer) ToDebugStr

func (i *Integer) ToDebugStr() string

type Keyword

type Keyword struct {
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func (*Keyword) Eval

func (k *Keyword) Eval(rt *Runtime, scope IScope) (*Keyword, IError)

Eval initializes the keyword by looking up the possible alias name and set it in the keyword.

func (*Keyword) GetType

func (k *Keyword) GetType() ast.NodeType

func (*Keyword) Hash

func (k *Keyword) Hash() uint32

func (*Keyword) IsNSQualified

func (k *Keyword) IsNSQualified() bool

func (*Keyword) SetNS

func (k *Keyword) SetNS(ns *Namespace)

func (*Keyword) String

func (k *Keyword) String() string

func (*Keyword) ToDebugStr

func (k *Keyword) ToDebugStr() string

type List

type List struct {
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func MakeEmptyList

func MakeEmptyList(n Node) *List

func MakeList

func MakeList(n Node, elements []IExpr) *List

func (*List) AppendToList

func (l *List) AppendToList(e IExpr) *List

func (*List) Cons

func (l *List) Cons(e IExpr) IExpr

func (*List) Count

func (l *List) Count() int

func (*List) First

func (l *List) First() IExpr

func (*List) GetType

func (l *List) GetType() ast.NodeType

func (*List) Hash

func (l *List) Hash() uint32

func (*List) Rest

func (l *List) Rest() ISeq

func (*List) String

func (l *List) String() string

func (*List) ToDebugStr

func (l *List) ToDebugStr() string

func (*List) ToSlice

func (l *List) ToSlice() []IExpr

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

func MakeNS

func MakeNS(rt *Runtime, name, source string) Namespace

MakeNS creates a new namespace with the given `name` and `source`

func (*Namespace) DefineGlobal

func (n *Namespace) DefineGlobal(k string, v IExpr, public bool)

DefineGlobal inserts the given expr `v` to the root scope of `n`. The `public` parameter determines whether the public value is accessible publicly or not (in other namespaces).

func (*Namespace) GetExecutionScope

func (n *Namespace) GetExecutionScope() IScope

func (*Namespace) GetLocation

func (n *Namespace) GetLocation() *ast.Location

func (*Namespace) GetName

func (n *Namespace) GetName() string

func (*Namespace) GetRootScope

func (n *Namespace) GetRootScope() IScope

func (*Namespace) GetType

func (n *Namespace) GetType() ast.NodeType

func (*Namespace) Hash

func (n *Namespace) Hash() uint32

func (*Namespace) LookupExternal

func (n *Namespace) LookupExternal(alias string) *Namespace

LookupExternal looks up the given `alias` in the `externals` table of the namespace.

func (*Namespace) LookupGlobal

func (n *Namespace) LookupGlobal(rt *Runtime, sym *Symbol) *Binding

LookupGlobal looks up the value represented by the ns qualified symbol `sym` in the external symbols table. Simply looking up a public value from an external namespace.

func (*Namespace) SetExecutionScope

func (n *Namespace) SetExecutionScope(scope IScope)

func (*Namespace) String

func (n *Namespace) String() string

func (*Namespace) ToDebugStr

func (n *Namespace) ToDebugStr() string

type NativeFunction

type NativeFunction struct {
	// Node struct holds the necessary functions to make
	// Functions locatable
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func MakeNativeFn

func MakeNativeFn(name string, f nativeFnHandler) NativeFunction

func (*NativeFunction) Apply

func (f *NativeFunction) Apply(rt *Runtime, scope IScope, n Node, args *List) (IExpr, IError)

func (*NativeFunction) GetName

func (f *NativeFunction) GetName() string

func (*NativeFunction) GetType

func (f *NativeFunction) GetType() ast.NodeType

func (*NativeFunction) Hash

func (f *NativeFunction) Hash() uint32

func (*NativeFunction) String

func (f *NativeFunction) String() string

func (*NativeFunction) ToDebugStr

func (f *NativeFunction) ToDebugStr() string

type Nil

type Nil struct {
	Node
	ExecutionScope
}

func MakeNil

func MakeNil(n Node) *Nil

func (*Nil) GetType

func (n *Nil) GetType() ast.NodeType

func (*Nil) Hash

func (n *Nil) Hash() uint32

func (*Nil) String

func (n *Nil) String() string

func (*Nil) ToDebugStr

func (n *Nil) ToDebugStr() string

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node struct is simply representing a Node in the AST which provides the functionalities required to trace the code based on the location.

func MakeNode

func MakeNode(input *ast.Source, start, end int) Node

MakeNode creates a new Node in the the given `input` that points to a range of characters starting from the `start` till the `end`.

func MakeNodeFromExpr

func MakeNodeFromExpr(e ast.ILocatable) Node

MakeNodeFromExpr creates a new Node from the given `ILocatable`. We use the Node to pass it to other IExpr constructors to keep the reference to the original form in the input string

func MakeNodeFromExprs

func MakeNodeFromExprs(es []IExpr) *Node

MakeNodeFromExprs creates a new Node from the given slice of `IExpr`s. We use the Node to pass it to other IExpr constructors to keep the reference to the original form in the input string

func MakeNodeFromLocation

func MakeNodeFromLocation(loc *ast.Location) Node

MakeNodeFromLocation creates a new Node for the given Location `loc`

func MakeSinglePointNode

func MakeSinglePointNode(input *ast.Source, point int) Node

MakeSinglePointNode creates a not the points to a single char in the input

func (Node) GetLocation

func (n Node) GetLocation() *ast.Location

GetLocation returns the location of the Node in the source input

type NothingType

type NothingType struct{}

func (NothingType) GetExecutionScope

func (n NothingType) GetExecutionScope() IScope

func (NothingType) GetLocation

func (n NothingType) GetLocation() *ast.Location

func (NothingType) GetType

func (n NothingType) GetType() ast.NodeType

func (NothingType) Hash

func (n NothingType) Hash() uint32

func (NothingType) SetExecutionScope

func (n NothingType) SetExecutionScope(scope IScope)

func (NothingType) String

func (n NothingType) String() string

func (NothingType) ToDebugStr

func (n NothingType) ToDebugStr() string

type Runtime

type Runtime struct {
	Stack CallStack
	// contains filtered or unexported fields
}

Runtime is the most important data structure in Serene which hold the necessary information and the state of the interpreter at runtime (duh!). At any given time and thread only on Runtime has to exist and we always need to pass a pointer to the runtime around and avoid copying. (We don't have multithread support just yet but the Runtime must be thread safe).

func MakeRuntime

func MakeRuntime(paths []string, flags map[string]bool) *Runtime

MakeRuntime creates a Runtime and returns a pointer to it. Any runtime initialization such as adding default namespaces and vice versa has to happen here.

func (*Runtime) CreateNS

func (r *Runtime) CreateNS(name, source string, setAsCurrent bool)

CreateNS is a helper function to create a namespace and set it to be the current namespace of the runtime. `MakeNS` is much preferred

func (*Runtime) CurrentNS

func (r *Runtime) CurrentNS() *Namespace

func (*Runtime) GetNS

func (r *Runtime) GetNS(ns string) (*Namespace, bool)

GetNS returns a pointer to the `Namespace` specified with the given name `ns` on the runtime.

func (*Runtime) InsertNS

func (r *Runtime) InsertNS(nsName string, ns *Namespace)

func (*Runtime) IsDebugMode

func (r *Runtime) IsDebugMode() bool

func (*Runtime) IsQQSimplificationEnabled

func (r *Runtime) IsQQSimplificationEnabled() bool

IsQQSimplificationEnabled returns a boolean value indicating whether simplification of quasiquotation is enabled or not. If yes, we have to replace the quasiquote expanded forms with a simpler form to gain a better performance.

func (*Runtime) LookupBuiltin

func (r *Runtime) LookupBuiltin(k string) IExpr

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

func MakeScope

func MakeScope(rt *Runtime, parent *Scope, namespace *string) *Scope

func (*Scope) GetNS

func (s *Scope) GetNS(rt *Runtime) *Namespace

func (*Scope) Insert

func (s *Scope) Insert(k string, v IExpr, public bool)

func (*Scope) Lookup

func (s *Scope) Lookup(rt *Runtime, k string) *Binding

func (*Scope) SetNS

func (s *Scope) SetNS(ns *string)

type String

type String struct {
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func MakeString

func MakeString(n Node, s string) *String

func (*String) Escape

func (s *String) Escape() string

func (*String) GetType

func (s *String) GetType() ast.NodeType

func (*String) Hash

func (s *String) Hash() uint32

func (*String) PrintToString

func (s *String) PrintToString() string

func (*String) String

func (s *String) String() string

func (*String) ToDebugStr

func (s *String) ToDebugStr() string

type StringParser

type StringParser struct {
	// contains filtered or unexported fields
}

StringParser is an implementation of the IParsable that operates on strings. To put it simply it parses input strings

func (*StringParser) Buffer

func (sp *StringParser) Buffer() *[]string

func (*StringParser) GetLocation

func (sp *StringParser) GetLocation() int

func (*StringParser) GetSource

func (sp *StringParser) GetSource() *ast.Source

type Symbol

type Symbol struct {
	Node
	ExecutionScope
	// contains filtered or unexported fields
}

func (*Symbol) GetNSPart

func (s *Symbol) GetNSPart() string

func (*Symbol) GetName

func (s *Symbol) GetName() string

func (*Symbol) GetType

func (s *Symbol) GetType() ast.NodeType

func (*Symbol) Hash

func (s *Symbol) Hash() uint32

func (*Symbol) IsNSQualified

func (s *Symbol) IsNSQualified() bool

func (*Symbol) IsRestable

func (s *Symbol) IsRestable() bool

func (*Symbol) String

func (s *Symbol) String() string

func (*Symbol) ToDebugStr

func (s *Symbol) ToDebugStr() string

type TraceBack

type TraceBack = []*Frame

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL