Package ds/any/syntax represents the Scheme library (ds any syntax).
Droscheme - a Scheme implementation
Copyright © 2012 Andrew Robbins, Daniel Connelly
This program is free software: it 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. You can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License (LGPLv3): <http://www.gnu.org/licenses/>.
Droscheme - a Scheme implementation
Copyright © 2012 Andrew Robbins, Daniel Connelly
This program is free software: it 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. You can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License (LGPLv3): <http://www.gnu.org/licenses/>.
- Constants
- type Label
- func (o Label) Equal(a Any) bool
- func (o Label) GetHash() uintptr
- func (o Label) GetType() int
- func (o Label) String() string
- type Lexer
- func (lex *Lexer) Error(e string)
- func (lex *Lexer) Lex(lval *yySymType) int
- type Matcher
- type Replacer
- type State
Package files
core.go
doc.go
ds_any_syntax.go
export.go
global.go
import.go
import2.go
label.go
lex.go
match.go
parse.go
shell.go
types.go
Constants
const BOOL = 57347
const CHAR = 57349
const COMMENT = 57365
const ELLIPSIS = 57362
const ID = 57346
const KEYWORD = 57364
const KSYMBOL = 57363
const LABEL = 57351
const NUMBER = 57348
const QQUOTE = 57355
const QSYNTAX = 57359
const QUOTE = 57354
const STRING = 57350
const SYNTAX = 57358
const U8VECTORPAREN = 57353
const UNQUOTE = 57356
const UNQUOTES = 57357
const UNSYNTAX = 57360
const UNSYNTAXS = 57361
const VECTORPAREN = 57352
type Label struct {
}
func (Label) Equal
func (o Label) Equal(a Any) bool
func (o Label) GetHash() uintptr
func (o Label) GetType() int
func (Label) String
func (o Label) String() string
type Lexer struct {
}
func (*Lexer) Error
func (lex *Lexer) Error(e string)
func (*Lexer) Lex
func (lex *Lexer) Lex(lval *yySymType) int
type Matcher interface {
Match(syntax Any, env *Env) bool
}
This interface represents the first phase
of (syntax-rules) transformations. It is
similar to Equal, except that it takes an
environment, which is normally empty, and
is used as an extra return value in which
pattern variables are bound.
The pattern variables are used by the next
phase, so in order to save energy later, we
assign any pattern variables found in the
object that implements this method and then
store them in env. The same environment is
also used for literals, which must be given
to the Match method in the form x=x.
type Replacer interface {
Replace(env *Env) Any
}
This interface represents the second phase
of (syntax-rules) transformations. It is
similar to Eval, except in the way that the
environment is used. Instead of raising an
error every time a symbol is unbound, it
continues silently, and only replaces those
symbols which are in the environment.
The pattern variables are given in env by the
Match method, in such a way that we can treat
literals the same as pattern variables, since
they are of the form x=x (see above). Hence,
the literals can safely be replaced just like
the pattern variables. This is the magic
I was hoping to describe in this comment.
type State func(*Lexer) State
[AJR] Yes, I watched Rob Pike