Various parts of sf were silently disabled in the overly aggressive
change
commit
816b9122751c9b60b85f9ce3db0df8a516f763cb
Author: Chris Hanson <org/chris-hanson/cph>
Date: Wed Jan 24 00:07:59 2018 -0800
Greatly simplify SCode abstraction and change names to contain "scode".
Also remove all FOO-components and FOO-subexpressions procedures.
More work remains: the lambda abstraction is an unholy mess and needs to be
cleaned up. The scan-defines stuff also merits some consideration.
which kinda reflects on the sensibility of using disjoint type
predicates across domains like this as one does in Scheme.
;; True if expression is a call to one of the primitive-boolean-predicates.
(define (expression/call-to-boolean-predicate? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(let ((operator (combination/operator expression)))
(and (constant? operator)
(let ((operator-value (constant/value operator)))
;; True if expression is a call to one of the effect-free-primitives.
(define (expression/call-to-effect-free-primitive? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(let ((operator (combination/operator expression)))
(and (constant? operator)
(let ((operator-value (constant/value operator)))
;; True if expression is a call to NOT.
;; Used in conditional simplification.
(define (expression/call-to-not? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(let ((operator (combination/operator expression)))
(and (constant? operator)
(let ((operator-value (constant/value operator)))
(define (expression/constant-eq? expression value)
(cond ((constant? expression) (eq? (constant/value expression) value))
- ((scode-declaration? expression)
+ ((declaration? expression)
(expression/constant-eq? (declaration/expression expression) value))
(else #f)))
name))
(define (global-ref? object)
- (and (scode-access? object)
+ (and (access? object)
(expression/constant-eq? (access/environment object)
system-global-environment)
(access/name object)))
(define (sequence/make scode actions)
(define (sequence/collect-actions collected actions)
(fold-left (lambda (reversed action)
- (if (scode-sequence? action)
+ (if (sequence? action)
(sequence/collect-actions reversed
(sequence/actions action))
(cons action reversed)))
integrated-predicate
consequent
alternative)
- (cond ((scode-sequence? integrated-predicate)
+ (cond ((sequence? integrated-predicate)
(sequence/make
(and expression (object/scode expression))
(append (except-last-pair (sequence/actions integrated-predicate))
(integrate/expression
operations environment alternative))))
- ((scode-sequence? integrated-predicate)
+ ((sequence? integrated-predicate)
(sequence/make
(and expression (object/scode expression))
(append (except-last-pair (sequence/actions integrated-predicate))
(if (null? (constant/value operand))
'()
'fail))
- ((not (scode-combination? operand))
+ ((not (combination? operand))
'fail)
(else
(let ((rator (combination/operator operand)))
(procedure-with-body body (encloser (procedure/body body))))
(scan-operator body encloser)))
(define (scan-operator operator encloser)
- (cond ((scode-sequence? operator)
+ (cond ((sequence? operator)
(let ((reversed-actions (reverse (sequence/actions operator))))
(scan-body (car reversed-actions)
(let ((commands (cdr reversed-actions)))
(sequence-with-actions
operator
(reverse (cons expression commands)))))))))
- ((scode-combination? operator)
+ ((combination? operator)
(let ((descend
(lambda (operator*)
(and (not (open-block? (procedure/body operator*)))
(combination/operands operator))
=> descend)
(else #f))))
- ((scode-declaration? operator)
+ ((declaration? operator)
(scan-body (declaration/expression operator)
(lambda (expression)
(encloser
;;;; General CAR/CDR Encodings
(define (call-to-car? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(constant-eq? (combination/operator expression) (ucode-primitive car))
(length=? (combination/operands expression) 1)))
(define (call-to-cdr? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(constant-eq? (combination/operator expression) (ucode-primitive cdr))
(length=? (combination/operands expression) 1)))
(define (call-to-general-car-cdr? expression)
- (and (scode-combination? expression)
+ (and (combination? expression)
(constant-eq? (combination/operator expression)
(ucode-primitive general-car-cdr))
(length=? (combination/operands expression) 2)
;; If procedure body is a sequence, scan the first elements and turn variable
;; references into IGNORE declarations.
(define (build-procedure expression block name required optional rest body)
- (if (scode-sequence? body)
+ (if (sequence? body)
(do ((actions (sequence/actions body) (cdr actions))
(ignores '()
(cons (variable/name (reference/variable (car actions)))