goscheme

package
v0.0.0-...-e19ec15 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2016 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

goscheme - a Lisp interpreter in Go Copyright (C) 2015 Jack Bister

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

goscheme - a Lisp interpreter in Go Copyright (C) 2015 Jack Bister

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tokenize

func Tokenize(s string) []string

Types

type Boolean

type Boolean bool

func (Boolean) String

func (b Boolean) String() string

type BuiltIn

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

func NewBuiltIn

func NewBuiltIn(name string, minParams, maxParams int, fn func(Environment, ...Expr) Expr) BuiltIn

NewBuiltIn exists to maintain one interface for creating new built ins even if the struct layout changes. Maybe a pimpl style thing would work in the future?

type Byte

type Byte byte

func (Byte) String

func (b Byte) String() string

type Channel

type Channel chan Expr

type Character

type Character rune

func (Character) String

func (c Character) String() string

type Complex

type Complex complex128

type Environment

type Environment struct {
	Local       map[string]Expr
	LocalSyntax map[Symbol]transformer
	Parent      *Environment
}
var GlobalEnv Environment

func R5RSNullEnv

func R5RSNullEnv() Environment

TODO: Obviously not complete yet. Also will include some non-R5RS stuff since e.g. the "go" keyword is baked inside Eval.

func StandardEnv

func StandardEnv() Environment

type Error

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

func (Error) Error

func (e Error) Error() string

type EvalBlock

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

An EvalBlock wraps an expression and delays evaluation of the expr. Primarily(only?) used for actions involving apostrophes.

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

func Eval

func Eval(e Expr, env Environment) Expr

func ExprListToSlice

func ExprListToSlice(el ExprList) []Expr

func Parse

func Parse(s *[]string, allowblock bool) Expr

type ExprList

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

func SliceToExprList

func SliceToExprList(el []Expr) ExprList

func (ExprList) Length

func (el ExprList) Length() int

func (ExprList) String

func (el ExprList) String() string

type Func

type Func func(...Expr) Expr

type Match

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

type Number

type Number float64

Number type The language does not distinguish between precise (int) and imprecise (float) values right now. 64 bit float should be sufficiently accurate for large ints.

type Pattern

type Pattern Expr

type Port

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

A port can either be written to or read from. bufio.Reader/Writer is used for some conveniences, but ports also must be closeable. The assumption is that for input-ports w and wclose will be nil, and vice versa. If r != nil then rclose must also be != nil, same with w and wclose. While R5RS seems to only deal with files this implementation is vague enough that adding network support shouldn't be a big deal.

type Proc

type Proc interface {
	// contains filtered or unexported methods
}

A Proc is any type that has a function satisfying the function signature. Built in functions and user defined functions are different, but both satisfy this interface.

type String

type String string

func (String) String

func (s String) String() string

type Symbol

type Symbol string

Symbol type The type used for variables. Can also be used as strings as long as it doesn't contain spaces...

type SyntaxRule

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

type UserProc

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

func (UserProc) String

func (u UserProc) String() string

type Vector

type Vector []Expr

func (Vector) String

func (v Vector) String() string

Directories

Path Synopsis
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.

Jump to

Keyboard shortcuts

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