summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-04-16 23:44:52 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-04-20 22:55:40 +0200
commit1180255e7b0e9e70a6d8b7665ac8a77886ef16a5 (patch)
treef0c11a1b6c5edcf5f21bc4e43ebfc84eb2c6b8f9 /plugins
parent6f85490fa3843a3ca6b180ab5863273a805402c1 (diff)
downloadxK-1180255e7b0e9e70a6d8b7665ac8a77886ef16a5.tar.gz
xK-1180255e7b0e9e70a6d8b7665ac8a77886ef16a5.tar.xz
xK-1180255e7b0e9e70a6d8b7665ac8a77886ef16a5.zip
calc: comment updates, import fixes
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/zyklonb/calc17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/zyklonb/calc b/plugins/zyklonb/calc
index e2f4be9..deea424 100755
--- a/plugins/zyklonb/calc
+++ b/plugins/zyklonb/calc
@@ -93,7 +93,10 @@
; --- Calculator ---------------------------------------------------------------
-; Evaluator derived from the example in The Scheme Programming Language
+; Evaluator derived from the example in The Scheme Programming Language.
+;
+; Even though EVAL with a carefully crafted environment would also do a good
+; job at sandboxing, it would probably be impossible to limit execution time...
(define (env-new formals actuals env)
(cond [(null? formals) env]
@@ -108,7 +111,8 @@
(error 'check-reductions "reduction limit exceeded")
(set-car! r (- (car r) 1))))
-; TODO - think about implementing more syntactical constructs
+; TODO - think about implementing more syntactical constructs,
+; however there's not much point in having anything else in a calculator...
(define (exec expr r env)
(check-reductions r)
(cond [(symbol? expr) (env-lookup expr env)]
@@ -135,6 +139,7 @@
[(_) '()]
[(_ a b ...) (cons (cons (quote a) a) (forward b ...))]))
+; ...which can't prevent me from simply importing most of the standard library
(define base-library
(forward
; Equivalence, procedure predicate, booleans
@@ -158,12 +163,12 @@
symbol? symbol=? symbol->string string->symbol
; Characters
char? char=? char<? char>? char<=? char>=? char->integer integer->char
- ; Strings; XXX make-string can make an arbitrary length string -> removed
+ ; Strings; XXX - omitted make-string - can cause OOM
string? string=? string<? string>? string<=? string>=?
- make-string string string-length string-ref substring
+ string string-length string-ref substring
string-append string->list list->string string-for-each string-copy
- ; Vectors; XXX make-vector can make an arbitrary length vectors -> removed
- vector? make-vector vector vector-length vector-ref vector-set!
+ ; Vectors; XXX - omitted make-vector - can cause OOM
+ vector? vector vector-length vector-ref vector-set!
vector->list list->vector vector-fill! vector-map vector-for-each
; Control features
apply call/cc values call-with-values dynamic-wind))