scheme

package
v0.0.0-...-be55f0a Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2014 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF = -(iota + 1)
	IdentifierToken
	IntToken
	BooleanToken
	StringToken
)
View Source
const BOOLEAN = 57348
View Source
const IDENTIFIER = 57346
View Source
const NUMBER = 57347
View Source
const STRING = 57349

Variables

View Source
var (
	Null = &Pair{ObjectBase: ObjectBase{parent: nil}, Car: nil, Cdr: nil}
)

Functions

This section is empty.

Types

type Actor

type Actor struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewActor

func NewActor(parent Object) *Actor

func (*Actor) Eval

func (a *Actor) Eval() Object

func (*Actor) Invoke

func (a *Actor) Invoke(argument Object) Object

func (*Actor) Start

func (a *Actor) Start()

func (*Actor) String

func (a *Actor) String() string

type Application

type Application struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(parent Object) *Application

func (*Application) Eval

func (a *Application) Eval() Object

func (*Application) String

func (a *Application) String() string

type Binding

type Binding map[string]Object

type Boolean

type Boolean struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewBoolean

func NewBoolean(value interface{}, options ...Object) (boolean *Boolean)

func (*Boolean) Eval

func (b *Boolean) Eval() Object

func (*Boolean) String

func (b *Boolean) String() string

type Closure

type Closure struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewClosure

func NewClosure(parent Object) *Closure

func WrapClosure

func WrapClosure(wrappedObject Object) *Closure

Cover the given object with a new closure. Insert this into tree structure between given object and its parent.

func (*Closure) DefineFunction

func (c *Closure) DefineFunction(s *Syntax, variables, body []Object)

func (*Closure) Invoke

func (c *Closure) Invoke(argument Object) Object

func (*Closure) String

func (c *Closure) String() string

type Interpreter

type Interpreter struct {
	*Parser
	// contains filtered or unexported fields
}

func NewInterpreter

func NewInterpreter(source string) *Interpreter

func (*Interpreter) DumpAST

func (i *Interpreter) DumpAST(object Object, indentLevel int)

func (*Interpreter) EvalResults

func (i *Interpreter) EvalResults(dumpAST bool) (results []string)

func (*Interpreter) PrintErrors

func (i *Interpreter) PrintErrors(dumpAST bool)

func (*Interpreter) PrintResults

func (i *Interpreter) PrintResults(dumpAST bool)

func (*Interpreter) ReloadSourceCode

func (i *Interpreter) ReloadSourceCode(source string)

Load new source code with current environment

type Invoker

type Invoker interface {
	Invoke(Object) Object
}

type Lexer

type Lexer struct {
	scanner.Scanner
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer(source string) *Lexer

func (Lexer) AllTokens

func (l Lexer) AllTokens() []string

func (*Lexer) Error

func (l *Lexer) Error(e string)

func (Lexer) IndentLevel

func (l Lexer) IndentLevel() int

func (*Lexer) Lex

func (l *Lexer) Lex(lval *yySymType) int

func (*Lexer) NextToken

func (l *Lexer) NextToken() string

This function returns next token and moves current token reading position to next token position.

func (Lexer) PeekToken

func (l Lexer) PeekToken() string

Non-destructive Lexer.NextToken().

func (Lexer) TokenType

func (l Lexer) TokenType() rune

Non-destructive scanner.Scan(). This method returns next token type or unicode character.

type Macro

type Macro struct {
	ObjectBase
}

func NewMacro

func NewMacro() *Macro

func (*Macro) Eval

func (m *Macro) Eval() Object

func (*Macro) String

func (m *Macro) String() string

type Number

type Number struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewNumber

func NewNumber(argument interface{}, options ...Object) *Number

func (*Number) Eval

func (n *Number) Eval() Object

func (*Number) String

func (n *Number) String() string

type Object

type Object interface {
	Parent() Object
	Bounder() *Variable

	Eval() Object
	String() string
	// contains filtered or unexported methods
}

type ObjectBase

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

func (*ObjectBase) Bounder

func (o *ObjectBase) Bounder() *Variable

func (*ObjectBase) Eval

func (o *ObjectBase) Eval() Object

func (*ObjectBase) Parent

func (o *ObjectBase) Parent() Object

func (*ObjectBase) String

func (o *ObjectBase) String() string

type Pair

type Pair struct {
	ObjectBase
	Car Object
	Cdr Object
}

func NewList

func NewList(parent Object, objects ...Object) *Pair

func NewPair

func NewPair(parent Object) *Pair

func (*Pair) Append

func (p *Pair) Append(object Object) *Pair

func (*Pair) AppendList

func (p *Pair) AppendList(list Object) *Pair

func (*Pair) ElementAt

func (p *Pair) ElementAt(index int) Object

func (*Pair) Elements

func (p *Pair) Elements() []Object

func (*Pair) Eval

func (p *Pair) Eval() Object

func (*Pair) ListLength

func (p *Pair) ListLength() int

func (*Pair) String

func (p *Pair) String() string

type Parser

type Parser struct {
	*Lexer
}

func NewParser

func NewParser(source string) *Parser

func (*Parser) Parse

func (p *Parser) Parse(parent Object) []Object

type String

type String struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewString

func NewString(object interface{}, options ...Object) *String

func (*String) Eval

func (s *String) Eval() Object

func (*String) String

func (s *String) String() string

type Subroutine

type Subroutine struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewSubroutine

func NewSubroutine(function func(*Subroutine, Object) Object) *Subroutine

func (*Subroutine) Eval

func (s *Subroutine) Eval() Object

func (*Subroutine) Invoke

func (s *Subroutine) Invoke(argument Object) Object

func (*Subroutine) String

func (s *Subroutine) String() string

type Symbol

type Symbol struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewSymbol

func NewSymbol(identifier string) *Symbol

func (*Symbol) Eval

func (s *Symbol) Eval() Object

func (*Symbol) String

func (s *Symbol) String() string

type Syntax

type Syntax struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewSyntax

func NewSyntax(function func(*Syntax, Object) Object) *Syntax

func (*Syntax) Invoke

func (s *Syntax) Invoke(arguments Object) Object

func (*Syntax) String

func (s *Syntax) String() string

type Variable

type Variable struct {
	ObjectBase
	// contains filtered or unexported fields
}

func NewVariable

func NewVariable(identifier string, parent Object) *Variable

func (*Variable) Eval

func (v *Variable) Eval() Object

func (*Variable) String

func (v *Variable) String() string

Jump to

Keyboard shortcuts

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