summaryrefslogtreecommitdiff
path: root/MLKInterpreter.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-30 21:04:34 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-30 21:04:34 +0200
commiteb968f738101d87b2d0e170d757ea10a27bbb867 (patch)
tree3841ee113f61a48ce9ba6f08bc42e2ecd1418152 /MLKInterpreter.m
parentee2d7b7d9bb5ab87dc7986407ee44acd6bcad429 (diff)
Create environments upon binding when needed.
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r--MLKInterpreter.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index e276982..2f9aba3 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -121,12 +121,16 @@ static MLKSymbol *_LAMBDA;
}
else if ([context variableIsLexical:program])
{
- //NSLog (@"Processing lexical variable.");
+ //NSLog (@"Processing lexical variable %@.", [program descriptionForLisp]);
+ //NSLog (@"Lexical environment: %@.", lexenv);
+ //NSLog (@"Lexical variable value: %@.", [lexenv valueForSymbol:program]);
return [NSArray arrayWithObject:nullify([lexenv valueForSymbol:program])];
}
else
{
- //NSLog (@"Processing special variable.");
+ //NSLog (@"Processing special variable %@.", [program descriptionForLisp]);
+ //NSLog (@"Dynamic context: %@.", dynamicContext);
+ //NSLog (@"Special variable value: %@.", [dynamicContext valueForSymbol:program]);
return [NSArray arrayWithObject:nullify([dynamicContext valueForSymbol:program])];
}
}
@@ -271,9 +275,9 @@ static MLKSymbol *_LAMBDA;
objectAtIndex:0]);
}
+ [ctx addVariable:variable];
if ([ctx variableIsLexical:variable])
{
- [ctx addVariable:variable];
[env addValue:value forSymbol:variable];
}
else
@@ -289,8 +293,8 @@ static MLKSymbol *_LAMBDA;
NS_DURING
{
result = [self eval:[MLKCons cons:PROGN with:body]
- inLexicalContext:context
- withEnvironment:lexenv];
+ inLexicalContext:ctx
+ withEnvironment:env];
}
NS_HANDLER
{