Documentation
¶
Overview ¶
Package hu implements (an interpreter for) a language optimized for humans.
Index ¶
- func AddDefaultBindings(environment Environment)
- func AddPrimitive(environment Environment, name string, function PrimitiveFunction)
- func Extend(environment Environment, variables, values Term)
- type Abstraction
- type Application
- type Boolean
- type Closure
- type Environment
- type Error
- type LocalEnvironment
- type NestedEnvironment
- type Number
- type Operator
- type Part
- type Primitive
- type PrimitiveFunction
- type Property
- type Reducible
- type Rune
- type Set
- type String
- type Symbol
- type Term
- type Tuple
- type UnboundVariableError
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 ¶
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 Closure ¶
type Closure struct {
Term Term
Environment Environment
}
func (Closure) Reduce ¶
func (closure Closure) Reduce(environment Environment) Term
type Environment ¶
type LocalEnvironment ¶
func (LocalEnvironment) Define ¶
func (environment LocalEnvironment) Define(variable Symbol, value Term)
type NestedEnvironment ¶
type NestedEnvironment struct {
Environment Environment
Parent Environment
}
func (*NestedEnvironment) Define ¶
func (ne *NestedEnvironment) Define(variable Symbol, value Term)
func (*NestedEnvironment) String ¶
func (environment *NestedEnvironment) String() string
type Primitive ¶
type Primitive func(Environment) Term
func (Primitive) Reduce ¶
func (p Primitive) Reduce(environment Environment) Term
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
}
type Reducible ¶
type Reducible interface {
Term
Reduce(Environment) Term
}
type Symbol ¶
type Symbol string
func (Symbol) Reduce ¶
func (s Symbol) Reduce(environment Environment) Term
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 UnboundVariableError ¶
type UnboundVariableError struct {
// contains filtered or unexported fields
}
func (UnboundVariableError) String ¶
func (e UnboundVariableError) String() string
Click to show internal directories.
Click to hide internal directories.