diff options
Diffstat (limited to 'MLKLexicalEnvironment.m')
-rw-r--r-- | MLKLexicalEnvironment.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/MLKLexicalEnvironment.m b/MLKLexicalEnvironment.m index 3d0c31c..07c6f92 100644 --- a/MLKLexicalEnvironment.m +++ b/MLKLexicalEnvironment.m @@ -50,6 +50,22 @@ static MLKLexicalEnvironment *global_environment; @implementation MLKLexicalEnvironment ++(void) initialize +{ + NSMutableDictionary *vars = [NSMutableDictionary dictionary]; + NSMutableDictionary *funs = [NSMutableDictionary dictionary]; + + MLKPackage *cl = [MLKPackage findPackage:@"COMMON-LISP"]; + // MLKPackage *sys = [MLKPackage findPackage:@"TOILET-SYSTEM"]; + + [vars setObject:[NSNull null] forKey:[NSNull null]]; + [vars setObject:[cl intern:@"T"] forKey:[cl intern:@"T"]]; + + global_environment = [[self alloc] initWithParent:nil + variables:vars + functions:funs]; +} + -(MLKLexicalEnvironment *) initWithParent:(MLKLexicalEnvironment *)aContext variables:(NSDictionary *)vars functions:(NSDictionary *)handlers @@ -66,6 +82,16 @@ static MLKLexicalEnvironment *global_environment; return global_environment; } +-(NSSet *) variables +{ + return [_variables bindings]; +} + +-(NSSet *) functions +{ + return [_functions bindings]; +} + -(id) valueForSymbol:(MLKSymbol *)symbol { return [_variables valueForBinding:symbol]; |