summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-07-27 11:11:45 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-07-27 11:11:45 +0200
commit47d502e02b4dc42d8192102c4e52764da09a90e5 (patch)
treea9fa912c063582f2c52455563a35151b236962d0
parentf91b134dcabcf82f8c35c67b5d43390b8e8d1ae2 (diff)
Make MACROEXPAND-ALL an entry point to the minimal compiler.
-rw-r--r--MLKPackage.m1
-rw-r--r--MLKRoot.m12
2 files changed, 13 insertions, 0 deletions
diff --git a/MLKPackage.m b/MLKPackage.m
index 039596a..7234c13 100644
--- a/MLKPackage.m
+++ b/MLKPackage.m
@@ -106,6 +106,7 @@ static NSMutableDictionary *packages = nil;
[sys export:[sys intern:@"DIVIDE"]];
[sys export:[sys intern:@"LIST"]];
[sys export:[sys intern:@"MACROEXPAND-1"]];
+ [sys export:[sys intern:@"MACROEXPAND-ALL"]];
[sys export:[sys intern:@"EXPORT"]];
[sys export:[sys intern:@"SHADOW"]];
[sys export:[sys intern:@"UNEXPORT"]];
diff --git a/MLKRoot.m b/MLKRoot.m
index d007173..a921c19 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -242,6 +242,18 @@ static id truify (BOOL value)
RETURN_VALUE (form);
}
++(NSArray *) macroexpand_all:(NSArray *)args
+{
+ id form = [args objectAtIndex:0];
+ id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil;
+ MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext];
+
+ return [MLKInterpreter eval:form
+ inLexicalContext:context
+ withEnvironment:nil
+ expandOnly:YES];
+}
+
+(NSArray *) shadow:(NSArray *)args
{
id symbols = denullify ([args objectAtIndex:0]);