summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-22 22:13:24 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-22 22:13:24 +0200
commitfeff6d33b25d0e61d09a08129c7f15c44c2609e0 (patch)
tree5fafc7be47b2f881745d0e70e2e09ba89f102401
parentc83bce248c8f70e9970fc46c5d74bdc98db766d3 (diff)
MLKInterpreter: Support QUOTE.
-rw-r--r--MLKInterpreter.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index 4ab03d2..1b4ddbb 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -28,6 +28,7 @@
#import "runtime-compatibility.h"
#import <Foundation/NSArray.h>
+#import <Foundation/NSException.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSString.h>
@@ -45,6 +46,7 @@ static MLKSymbol *LET;
static MLKSymbol *APPLY;
static MLKSymbol *FUNCALL;
static MLKSymbol *EVAL;
+static MLKSymbol *QUOTE;
static MLKSymbol *_DEFMACRO;
@@ -64,6 +66,7 @@ static MLKSymbol *_DEFMACRO;
LET = [cl intern:@"LET"];
APPLY = [cl intern:@"APPLY"];
EVAL = [cl intern:@"EVAL"];
+ QUOTE = [cl intern:@"QUOTE"];
_DEFMACRO = [sys intern:@"%DEFMACRO"];
}
@@ -128,6 +131,10 @@ static MLKSymbol *_DEFMACRO;
return result;
}
+ else if (car == QUOTE)
+ {
+ return [program cdr];
+ }
else if (car == TAGBODY)
{
//FIXME: ...
@@ -161,6 +168,12 @@ static MLKSymbol *_DEFMACRO;
inLexicalContext:context
withEnvironment:lexenv];
}
+ else
+ {
+ [NSException raise:@"MLKNoSuchOperatorException"
+ format:@"%@ does not name an known operator.",
+ [car descriptionForLisp]];
+ }
}
}
else if (![car isKindOfClass:[MLKCons class]] && [car car] == LAMBDA)