hu

package module
v0.0.0-...-4d75f45 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2015 License: BSD-3-Clause Imports: 7 Imported by: 3

README

To install:

> go install github.com/eikeon/hu

Documentation

Overview

Package hu implements (an interpreter for) a language optimized for humans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultBindings

func AddDefaultBindings(environment Environment)

func AddPrimitive

func AddPrimitive(environment Environment, name string, function PrimitiveFunction)

func Extend

func Extend(environment Environment, variables, values Term)

Types

type Abstraction

type Abstraction struct {
	Parameters Term
	Term       Term
}

func (Abstraction) String

func (abstraction Abstraction) String() string

type Application

type Application []Term

func (Application) Reduce

func (application Application) Reduce(environment Environment) Term

func (Application) String

func (application Application) String() string

type Boolean

type Boolean bool

func (Boolean) String

func (b Boolean) String() (result string)

type Closure

type Closure struct {
	Term        Term
	Environment Environment
}

func (Closure) Reduce

func (closure Closure) Reduce(environment Environment) Term

func (Closure) String

func (closure Closure) String() string

type Environment

type Environment interface {
	Define(variable Symbol, value Term)
	Set(variable Symbol, value Term) bool
	Get(variable Symbol) (Term, bool)
}

type Error

type Error string

func (Error) String

func (error Error) String() string

type LocalEnvironment

type LocalEnvironment map[Symbol]Term

func (LocalEnvironment) Define

func (environment LocalEnvironment) Define(variable Symbol, value Term)

func (LocalEnvironment) Get

func (environment LocalEnvironment) Get(variable Symbol) (Term, bool)

func (LocalEnvironment) Set

func (environment LocalEnvironment) Set(variable Symbol, value Term) bool

type NestedEnvironment

type NestedEnvironment struct {
	Environment Environment
	Parent      Environment
}

func (*NestedEnvironment) Define

func (ne *NestedEnvironment) Define(variable Symbol, value Term)

func (*NestedEnvironment) Get

func (ne *NestedEnvironment) Get(variable Symbol) (Term, bool)

func (*NestedEnvironment) Set

func (ne *NestedEnvironment) Set(variable Symbol, value Term) bool

func (*NestedEnvironment) String

func (environment *NestedEnvironment) String() string

type Number

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

func (*Number) String

func (n *Number) String() string

type Operator

type Operator interface {
	Term
	// contains filtered or unexported methods
}

type Part

type Part []Term

func ReadDocument

func ReadDocument(in io.RuneScanner) Part

func (Part) String

func (part Part) String() string

type Primitive

type Primitive func(Environment) Term

func (Primitive) Reduce

func (p Primitive) Reduce(environment Environment) Term

func (Primitive) String

func (p Primitive) String() string

type PrimitiveFunction

type PrimitiveFunction func(Environment, Term) Term

func (PrimitiveFunction) String

func (pf PrimitiveFunction) String() string

type Property

type Property struct {
	Name   Symbol
	DidSet Abstraction
}

func (Property) String

func (property Property) String() string

type Reducible

type Reducible interface {
	Term
	Reduce(Environment) Term
}

type Rune

type Rune int

func (Rune) String

func (rune Rune) String() string

type Set

type Set []Term

func (Set) String

func (set Set) String() string

type String

type String string

func (String) String

func (s String) String() string

type Symbol

type Symbol string

func (Symbol) Reduce

func (s Symbol) Reduce(environment Environment) Term

func (Symbol) String

func (s Symbol) String() string

type Term

type Term interface {
	String() string
}

func Evaluate

func Evaluate(environment Environment, term Term) Term

func GuardedEvaluate

func GuardedEvaluate(environment Environment, expression Term) (result Term)

func Read

func Read(in io.RuneScanner) (result Term)

func ReadMessage

func ReadMessage(in io.RuneScanner) []Term

func ReadSentence

func ReadSentence(in io.RuneScanner) []Term

type Tuple

type Tuple []Term

func (Tuple) String

func (tuple Tuple) String() string

type UnboundVariableError

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

func (UnboundVariableError) String

func (e UnboundVariableError) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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