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 ¶
- func Tokenize(s string) []string
- type Boolean
- type BuiltIn
- type Byte
- type Channel
- type Character
- type Complex
- type Environment
- type Error
- type EvalBlock
- type Expr
- type ExprList
- type Func
- type Match
- type Number
- type Pattern
- type Port
- type Proc
- type String
- type Symbol
- type SyntaxRule
- type UserProc
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuiltIn ¶
type BuiltIn struct {
// contains filtered or unexported fields
}
func NewBuiltIn ¶
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 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 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 ¶
type ExprList ¶
type ExprList struct {
// contains filtered or unexported fields
}
func SliceToExprList ¶
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 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 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
}