A dumb implementation of a proto-lisp
|
3 years ago | |
---|---|---|
MyLisp | 3 years ago | |
MyLispConsole | 3 years ago | |
.gitignore | 3 years ago | |
readme.md | 3 years ago |
Cell := Data, Pointer
List of functions
Garbage collection
Environment is a sequences of Frames are a table of bindings which associate names with values (names must be single-valued)
var Value(Variable, Frame){
if(Frame.Bindings.Contains(Variable)){
return Frame.Bindings[Variable]
} else if(Frame.Parent != null) {
return Value(Variable, Frame.Parent)
} else {
throw new VariableNotBoundException()
}
}
The way that Frames form sequences is by each having a pointer to another frame. Therefore we can have a tree of frames, with an environment for each leaf (corresponding to the sequence of frames from the leaf to the root).
var Eval(Expression, Environment){
}