ikarus/src/syntax.ss

1597 lines
71 KiB
Scheme
Raw Normal View History

(define chi-top-library
(let ()
;(define my-map
; (lambda (ctxt f ls . ls*)
; (cond
; [(and (list? ls)
; (andmap list? ls*)
; (let ([n (length ls)])
; (andmap (lambda (ls) (= (length ls) n)) ls*)))
; (let loop ([ls ls] [ls* ls*])
; (cond
; [(null? ls) '()]
; [else
; (cons (apply f (car ls) (#%map car ls*))
; (loop (cdr ls) (#%map cdr ls*)))]))]
; [else (error ctxt "invalid args ~s" (cons ls ls*))])))
;(define-syntax map
; (syntax-rules ()
; [(_ f ls ls* ...)
; (my-map '(map f ls ls* ...) f ls ls* ...)]))
(define-syntax build-let
(syntax-rules ()
[(_ ae lhs* rhs* body)
(build-application ae
(build-lambda ae lhs* body)
rhs*)]))
(define who 'chi-top-library)
(define-syntax assert
(syntax-rules ()
[(_ name pred* ...)
(unless (and pred* ...)
(error 'name "assertion ~s failed" '(pred* ...)))]))
(define top-mark* '(top))
(define top-marked?
(lambda (m*) (memq 'top m*)))
(define gen-lexical
(lambda (sym)
(cond
[(symbol? sym)
(gensym (symbol->string sym))]
[(stx? sym) (gen-lexical (id->sym sym))]
[else (error 'gen-lexical "invalid arg ~s" sym)])))
(define gen-label
(lambda (_) (gensym)))
(define make-rib
(lambda (sym* mark** label*)
(vector 'rib sym* mark** label*)))
(define id/label-rib
(lambda (id* label*)
(make-rib (map id->sym id*) (map stx-mark* id*) label*)))
(define make-empty-rib
(lambda ()
(make-rib '() '() '())))
(define extend-rib!
(lambda (rib id label)
(if (rib? rib)
(let ([sym (id->sym id)] [mark* (stx-mark* id)])
(vector-set! rib 1 (cons sym (vector-ref rib 1)))
(vector-set! rib 2 (cons mark* (vector-ref rib 2)))
(vector-set! rib 3 (cons label (vector-ref rib 3))))
(error 'extend-rib! "~s is not a rib" rib))))
(define rib?
(lambda (x)
(and (vector? x)
(= (vector-length x) 4)
(eq? (vector-ref x 0) 'rib))))
(define rib-sym*
(lambda (x)
(if (rib? x)
(vector-ref x 1)
(error 'rib-sym* "~s is not a rib" x))))
(define rib-mark**
(lambda (x)
(if (rib? x)
(vector-ref x 2)
(error 'rib-mark** "~s is not a rib" x))))
(define rib-label*
(lambda (x)
(if (rib? x)
(vector-ref x 3)
(error 'rib-label* "~s is not a rib" x))))
(define make-stx
(lambda (e m* s*)
(vector 'stx e m* s*)))
(define stx?
(lambda (x)
(and (vector? x)
(= (vector-length x) 4)
(eq? (vector-ref x 0) 'stx))))
(define stx-expr
(lambda (x)
(if (stx? x)
(vector-ref x 1)
(error 'stx-expr "~s is not a syntax object" x))))
(define stx-mark*
(lambda (x)
(if (stx? x)
(vector-ref x 2)
(error 'stx-mark* "~s is not a syntax object" x))))
(define stx-subst*
(lambda (x)
(if (stx? x)
(vector-ref x 3)
(error 'stx-subst* "~s is not a syntax object" x))))
(define datum->stx
(lambda (id datum)
(make-stx datum (stx-mark* id) (stx-subst* id))))
(define join-wraps
(lambda (m1* s1* e)
(define cancel
(lambda (ls1 ls2)
(let f ((x (car ls1)) (ls1 (cdr ls1)))
(if (null? ls1)
(cdr ls2)
(cons x (f (car ls1) (cdr ls1)))))))
(let ((m2* (stx-mark* e)) (s2* (stx-subst* e)))
(if (and (not (null? m1*))
(not (null? m2*))
(eq? (car m2*) anti-mark))
; cancel mark, anti-mark, and corresponding shifts
(values (cancel m1* m2*) (cancel s1* s2*))
(values (append m1* m2*) (append s1* s2*))))))
(define stx
(lambda (e m* s*)
(if (stx? e)
(let-values ([(m* s*) (join-wraps m* s* e)])
(make-stx (stx-expr e) m* s*))
(make-stx e m* s*))))
(define sym->free-id
(lambda (x)
(stx x top-mark* '())))
(define add-subst
(lambda (subst e)
(if subst
(stx e '() (list subst))
e)))
(define gen-mark
(lambda () (string #\m)))
(define add-mark
(lambda (m e)
(stx e (list m) '(shift))))
(define anti-mark #f)
(define syntax-kind?
(lambda (x p?)
(if (stx? x)
(syntax-kind? (stx-expr x) p?)
(p? x))))
(define syntax-pair?
(lambda (x) (syntax-kind? x pair?)))
(define syntax-null?
(lambda (x) (syntax-kind? x null?)))
(define syntax-list?
(lambda (x)
(or (syntax-null? x)
(and (syntax-pair? x) (syntax-list? (syntax-cdr x))))))
(define syntax-car
(lambda (x)
(if (stx? x)
(stx (syntax-car (stx-expr x)) (stx-mark* x) (stx-subst* x))
(if (pair? x)
(car x)
(error 'syntax-car "~s is not a pair" x)))))
(define syntax->list
(lambda (x)
(if (syntax-pair? x)
(cons (syntax-car x) (syntax->list (syntax-cdr x)))
(if (syntax-null? x)
'()
(error 'syntax->list "invalid ~s" x)))))
(define syntax-cdr
(lambda (x)
(if (stx? x)
(stx (syntax-cdr (stx-expr x)) (stx-mark* x) (stx-subst* x))
(if (pair? x)
(cdr x)
(error 'syntax-cdr "~s is not a pair" x)))))
(define id?
(lambda (x) (syntax-kind? x symbol?)))
(define id->sym
(lambda (x)
(if (stx? x)
(id->sym (stx-expr x))
(if (symbol? x)
x
(error 'id->sym "~s is not an id" x)))))
(define same-marks?
(lambda (x y)
(or (eq? x y)
(and (pair? x) (pair? y)
(eq? (car x) (car y))
(same-marks? (cdr x) (cdr y))))))
(define bound-id=?
(lambda (x y)
(and (eq? (id->sym x) (id->sym y))
(same-marks? (stx-mark* x) (stx-mark* y)))))
(define free-id=?
(lambda (i j)
(let ((t0 (id->label i)) (t1 (id->label j)))
(if (or t0 t1)
(eq? t0 t1)
(eq? (id->sym i) (id->sym j))))))
(define valid-bound-ids?
(lambda (id*)
(and (andmap id? id*)
(distinct-bound-ids? id*))))
(define distinct-bound-ids?
(lambda (id*)
(or (null? id*)
(and (not (bound-id-member? (car id*) (cdr id*)))
(distinct-bound-ids? (cdr id*))))))
(define bound-id-member?
(lambda (id id*)
(and (pair? id*)
(or (bound-id=? id (car id*))
(bound-id-member? id (cdr id*))))))
(define self-evaluating?
(lambda (x)
(or (number? x) (string? x) (char? x) (boolean? x))))
(define strip
(lambda (x m*)
(if (top-marked? m*)
x
(let f ([x x])
(cond
[(stx? x) (strip (stx-expr x) (stx-mark* x))]
[(pair? x)
(let ([a (f (car x))] [d (f (cdr x))])
(if (and (eq? a (car x)) (eq? d (cdr x)))
x
(cons a d)))]
[(vector? x)
(let ([old (vector->list x)])
(let ([new (map f old)])
(if (andmap eq? old new)
x
(list->vector new))))]
[else x])))))
(define id->label
(lambda (id)
(assert id->label (id? id))
(let ([sym (id->sym id)])
(let search ([subst* (stx-subst* id)] [mark* (stx-mark* id)])
(cond
[(null? subst*) #f]
[(eq? (car subst*) 'shift)
(search (cdr subst*) (cdr mark*))]
[else
(let ([rib (car subst*)])
(let f ([sym* (rib-sym* rib)]
[mark** (rib-mark** rib)]
[label* (rib-label* rib)])
(cond
[(null? sym*) (search (cdr subst*) mark*)]
[(and (eq? (car sym*) sym)
(same-marks? (car mark**) mark*))
(car label*)]
[else (f (cdr sym*) (cdr mark**) (cdr label*))])))])))))
(define label->binding
(lambda (x r)
(cond
[(not x) (cons 'unbound #f)]
[(assq x r) => cdr]
[else (cons 'displaced-lexical #f)])))
(define syntax-type
(lambda (e r)
(cond
[(id? e)
(let ([id e])
(let* ([label (id->label id)]
[b (label->binding label r)]
[type (binding-type b)])
(unless label
(stx-error e "unbound identifier"))
(case type
[(lexical core-prim)
(values type (binding-value b) id)]
[else (values 'other #f #f)])))]
[(syntax-pair? e)
(let ([id (syntax-car e)])
(if (id? id)
(let* ([label (id->label id)]
[b (label->binding label r)]
[type (binding-type b)])
(case type
2007-04-29 18:35:18 -04:00
[(define define-syntax core-macro begin macro
module set!)
(values type (binding-value b) id)]
[else
(values 'call #f #f)]))
(values 'call #f #f)))]
[else (let ([d (strip e '())])
(if (self-evaluating? d)
(values 'constant d #f)
(values 'other #f #f)))])))
(define parse-library
(lambda (e)
(syntax-match e
[(_ (name name* ...)
(export exp* ...)
(import (scheme))
b* ...)
(if (and (eq? export 'export)
(eq? import 'import)
(eq? scheme 'scheme)
(symbol? name)
(andmap symbol? name*)
(andmap symbol? exp*))
(values (cons name name*) exp* b*)
(error who "malformed library ~s" e))]
[_ (error who "malformed library ~s" e)])))
(define-syntax stx-error
(syntax-rules ()
[(_ stx) (error 'chi "invalid syntax ~s" (strip stx '()))]
[(_ stx msg) (error 'chi "~a: ~s" msg (strip stx '()))]))
;(define stx-error
; (lambda (stx . args)
; (error 'chi "invalid syntax ~s" (strip stx '()))))
(define sanitize-binding
(lambda (x)
(cond
[(procedure? x) (cons 'macro x)]
[(and (pair? x) (eq? (car x) 'macro!) (procedure? (cdr x)))
x]
[(and (pair? x) (eq? (car x) '$rtd)) x]
[else (error 'expand "invalid transformer ~s" x)])))
(define make-eval-transformer
(lambda (x)
(sanitize-binding (local-eval-hook x))))
(define-syntax syntax-match-test
(lambda (stx)
(define dots?
(lambda (x)
(and (identifier? x)
(free-identifier=? x #'(... ...)))))
(define f
(lambda (stx)
(syntax-case stx ()
[id (identifier? #'id) #'(lambda (x) #t)]
[(pat dots) (dots? #'dots)
(with-syntax ([p (f #'pat)])
#'(lambda (x)
(and (syntax-list? x)
(andmap p (syntax->list x)))))]
[(pat dots . last) (dots? #'dots)
(with-syntax ([p (f #'pat)] [l (f #'last)])
#'(lambda (x)
(let loop ([x x])
(cond
[(syntax-pair? x)
(and (p (syntax-car x))
(loop (syntax-cdr x)))]
[else (l x)]))))]
[(a . d)
(with-syntax ([pa (f #'a)] [pd (f #'d)])
#'(lambda (x)
(and (syntax-pair? x)
(pa (syntax-car x))
(pd (syntax-cdr x)))))]
[datum
#'(lambda (x)
(equal? (strip x '()) 'datum))])))
(syntax-case stx ()
[(_ x [pat code code* ...])
(with-syntax ([pat-code (f #'pat)])
#'(pat-code x))])))
(define-syntax syntax-match-conseq
(lambda (stx)
(define dots?
(lambda (x)
(and (identifier? x)
(free-identifier=? x #'(... ...)))))
(define f
(lambda (stx)
(syntax-case stx ()
[id (identifier? #'id)
(values (list #'id) #'(lambda (x) x))]
[(pat dots) (dots? #'dots)
(let-values ([(vars extractor) (f #'pat)])
(cond
[(null? vars)
(values '() #'(lambda (x) (dont-call-me)))]
[else
(values vars
(with-syntax ([(vars ...) vars]
[ext extractor]
[(t* ...) (generate-temporaries vars)])
#'(lambda (x)
(let f ([x x] [vars '()] ...)
(cond
[(syntax-null? x)
(values (reverse vars) ...)]
[else
(let-values ([(t* ...) (ext (syntax-car x))])
(f (syntax-cdr x)
(cons t* vars)
...))])))))]))]
[(pat dots . last) (dots? #'dots)
(let-values ([(pvars pext) (f #'pat)])
(let-values ([(lvars lext) (f #'last)])
(cond
[(and (null? pvars) (null? lvars))
(values '() #'(lambda (x) (dont-call-me)))]
[(null? lvars)
(values pvars
(with-syntax ([(pvars ...) pvars]
[(t* ...) (generate-temporaries pvars)]
[pext pext])
#'(lambda (x)
(let loop ([x x] [pvars '()] ...)
(cond
[(syntax-pair? x)
(let-values ([(t* ...) (pext (syntax-car x))])
(loop (syntax-cdr x)
(cons t* pvars) ...))]
[else
(values (reverse pvars) ...)])))))]
[(null? pvars)
(values lvars
(with-syntax ([lext lext])
#'(let loop ([x x])
(cond
[(syntax-pair? x) (loop (syntax-cdr x))]
[else (lext x)]))))]
[else
(values (append pvars lvars)
(with-syntax ([(pvars ...) pvars]
[(t* ...) (generate-temporaries pvars)]
[(lvars ...) lvars]
[lext lext]
[pext pext])
#'(lambda (x)
(let loop ([x x] [pvars '()] ...)
(cond
[(syntax-pair? x)
(let-values ([(t* ...) (pext (syntax-car x))])
(loop (syntax-cdr x)
(cons t* pvars) ...))]
[else
(let-values ([(lvars ...) (lext x)])
(values (reverse pvars) ...
lvars ...))])))))])))]
[(a . d)
(let-values ([(avars aextractor) (f #'a)])
(let-values ([(dvars dextractor) (f #'d)])
(cond
[(and (null? avars) (null? dvars))
(values '() #'(lambda (x) (dot-call-me)))]
[(null? avars)
(values dvars
(with-syntax ([d dextractor])
#'(lambda (x) (d (syntax-cdr x)))))]
[(null? dvars)
(values avars
(with-syntax ([a aextractor])
#'(lambda (x) (a (syntax-car x)))))]
[else
(values (append avars dvars)
(with-syntax ([(avars ...) avars]
[(dvars ...) dvars]
[a aextractor]
[d dextractor])
#'(lambda (x)
(let-values ([(avars ...) (a (syntax-car x))])
(let-values ([(dvars ...) (d (syntax-cdr x))])
(values avars ... dvars ...))))))])))]
[datum
(values '() #'(lambda (x) (dot-call-me)))])))
(syntax-case stx ()
[(_ x [pat code code* ...])
(let-values ([(vars extractor)
(f #'pat)])
(with-syntax ([e extractor] [(vs ...) vars])
(case (length vars)
[(0) #'(begin code code* ...)]
[(1) #'(let ([vs ... (e x)]) code code* ...)]
[else #'(let-values ([(vs ...) (e x)]) code code* ...)])))])))
(define-syntax syntax-match
(lambda (x)
(syntax-case x ()
[(_ expr) #'(stx-error expr)]
[(_ expr cls cls* ...)
#'(let ([t expr])
(if (syntax-match-test t cls)
(syntax-match-conseq t cls)
(syntax-match t cls* ...)))])))
(define parse-define
(lambda (x)
(syntax-match x
[(_ (id . fmls) b b* ...)
(if (id? id)
(values id
(cons 'defun (cons fmls (cons b b*))))
(stx-error x))]
[(_ id val)
(if (id? id)
(values id (cons 'expr val))
(stx-error x))])))
(define parse-define-syntax
(lambda (x)
(syntax-match x
[(_ id val)
(if (id? id)
(values id val)
(stx-error x))])))
(define scheme-env ; the-env
'([define define-label (define)]
[define-syntax define-syntax-label (define-syntax)]
[module module-label (module)]
[begin begin-label (begin)]
2007-04-29 18:35:18 -04:00
[set! set!-label (set!)]
[define-record define-record-label (macro . define-record)]
[case case-label (core-macro . case)]
[foreign-call foreign-call-label (core-macro . foreign-call)]
[quote quote-label (core-macro . quote)]
[lambda lambda-label (core-macro . lambda)]
[case-lambda case-lambda-label (core-macro . case-lambda)]
[let-values let-values-label (core-macro . let-values)]
[let let-label (core-macro . let)]
2007-04-30 00:31:21 -04:00
[letrec letrec-label (core-macro . letrec)]
[let* let*-label (core-macro . let*)]
[cond cond-label (core-macro . cond)]
[if if-label (core-macro . if)]
[when when-label (core-macro . when)]
[unless unless-label (core-macro . unless)]
[and and-label (core-macro . and)]
[or or-label (core-macro . or)]
2007-04-29 18:35:18 -04:00
[parameterize parameterize-label (core-macro . parameterize)]
;;; prims
2007-04-29 21:25:31 -04:00
[void void-label (core-prim . void)]
[not not-label (core-prim . not)]
[boolean? boolean-label (core-prim . boolean?)]
[null? null?-label (core-prim . null?)]
[procedure? procedure?-label (core-prim . procedure?)]
[eof-object? eof-object?-label (core-prim . eof-object?)]
2007-04-29 22:29:42 -04:00
[eof-object eof-object-label (core-prim . eof-object)]
2007-04-29 18:35:18 -04:00
;;; comparison
[eq? eq?-label (core-prim . eq?)]
[eqv? eqv?-label (core-prim . eqv?)]
[equal? equal?-label (core-prim . equal?)]
;;; pairs/lists
[cons cons-label (core-prim . cons)]
[pair? pair?-label (core-prim . pair?)]
[car car-label (core-prim . car)]
[cdr cdr-label (core-prim . cdr)]
2007-04-29 20:55:51 -04:00
[set-car! set-car!-label (core-prim . set-car!)]
[set-cdr! set-cdr!-label (core-prim . set-cdr!)]
[caar caar-label (core-prim . caar)]
[cdar cdar-label (core-prim . cdar)]
[cadr cadr-label (core-prim . cadr)]
[cddr cddr-label (core-prim . cddr)]
2007-04-29 18:35:18 -04:00
[list list-label (core-prim . list)]
2007-04-30 00:31:21 -04:00
[list-ref list-ref-label (core-prim . list-ref)]
2007-04-29 22:29:42 -04:00
[make-list make-list-label (core-prim . make-list)]
[list* list*-label (core-prim . list*)]
[list? list?-label (core-prim . list?)]
2007-04-29 18:35:18 -04:00
[append append-label (core-prim . append)]
2007-04-30 00:31:21 -04:00
[last-pair last-pair-label (core-prim . last-pair)]
2007-04-29 22:29:42 -04:00
[reverse reverse-label (core-prim . reverse)]
[length length-label (core-prim . length)]
[assq assq-label (core-prim . assq)]
[assv assv-label (core-prim . assv)]
[assoc assoc-label (core-prim . assoc)]
2007-04-29 20:55:51 -04:00
[memq memq-label (core-prim . memq)]
[memv memv-label (core-prim . memv)]
[member member-label (core-prim . member)]
2007-04-29 23:00:20 -04:00
[$car $car-label (core-prim . $car)]
[$cdr $cdr-label (core-prim . $cdr)]
2007-04-29 23:13:19 -04:00
[$set-car! $set-car!-label (core-prim . $set-car!)]
[$set-cdr! $set-cdr!-label (core-prim . $set-cdr!)]
2007-04-30 00:31:21 -04:00
[$memq $memq-label (core-prim . $memq)]
[$memv $memv-label (core-prim . $memv)]
;;; weak conses
[bwp-object? bwp-object?-label (core-prim . bwp-object?)]
[weak-cons weak-cons-label (core-prim . weak-cons)]
[weak-pair? weak-pair?-label (core-prim . weak-pair?)]
2007-04-29 18:35:18 -04:00
;;; chars
2007-04-29 21:25:31 -04:00
[char? char?-label (core-prim . char?)]
2007-04-29 05:02:44 -04:00
[char=? char=?-label (core-prim . char=?)]
2007-04-30 00:31:21 -04:00
[char<? char<?-label (core-prim . char<?)]
[char>? char>?-label (core-prim . char>?)]
[char<=? char<=?-label (core-prim . char<=?)]
[char>=? char>=?-label (core-prim . char>=?)]
[integer->char integer->char-label (core-prim . integer->char)]
[char->integer char->integer-label (core-prim . char->integer)]
2007-04-29 22:29:42 -04:00
[char-whitespace? char-whitespace?-label (core-prim . char-whitespace?)]
[$char? $char?-label (core-prim . $char?)]
[$char= $char=-label (core-prim . $char=)]
2007-04-30 00:31:21 -04:00
[$char< $char<-label (core-prim . $char<)]
[$char> $char>-label (core-prim . $char>)]
[$char<= $char<=-label (core-prim . $char<=)]
[$char>= $char>=-label (core-prim . $char>=)]
2007-04-29 22:29:42 -04:00
[$char->fixnum $char->fixnum-label (core-prim . $char->fixnum)]
2007-04-29 23:00:20 -04:00
[$fixnum->char $fixnum->char-label (core-prim . $fixnum->char)]
2007-04-29 18:35:18 -04:00
;;; strings
2007-04-29 05:02:44 -04:00
[string? string?-label (core-prim . string?)]
2007-04-30 00:31:21 -04:00
[string string-label (core-prim . string)]
2007-04-29 22:29:42 -04:00
[make-string make-string-label (core-prim . make-string)]
2007-04-29 05:02:44 -04:00
[string-ref string-ref-label (core-prim . string-ref)]
[string-set! string-set!-label (core-prim . string-set!)]
2007-04-29 05:02:44 -04:00
[string-length string-length-label (core-prim . string-length)]
[string=? string=?-label (core-prim . string=?)]
[substring substring-label (core-prim . substring)]
2007-04-30 00:31:21 -04:00
[string-append string-append-label (core-prim . string-append)]
[string->list string->list-label (core-prim . string->list)]
2007-04-29 22:29:42 -04:00
[list->string list->string-label (core-prim . list->string)]
2007-04-30 00:31:21 -04:00
[uuid uuid-label (core-prim . uuid)]
[date-string date-string-label (core-prim . date-string)]
[$make-string $make-string-label (core-prim . $make-string)]
2007-04-29 23:00:20 -04:00
[$string-ref $string-ref-label (core-prim . $string-ref)]
[$string-set! $string-set!-label (core-prim . $string-set!)]
[$string-length $string-length-label (core-prim . $string-length)]
2007-04-29 18:35:18 -04:00
;;; vectors
[vector vector-label (core-prim . vector)]
2007-04-29 22:29:42 -04:00
[make-vector make-vector-label (core-prim . make-vector)]
[vector-ref vector-ref-label (core-prim . vector-ref)]
[vector-set! vector-set!-label (core-prim . vector-set!)]
[vector? vector?-label (core-prim . vector?)]
[vector-length vector-length-label (core-prim . vector-length)]
2007-04-29 18:35:18 -04:00
[list->vector list->vector-label (core-prim . list->vector)]
[vector->list vector->list-label (core-prim . vector->list)]
2007-04-30 00:31:21 -04:00
[$make-vector $make-vector-label (core-prim . $make-vector)]
2007-04-29 23:13:19 -04:00
[$vector-length $vector-length-label (core-prim . $vector-length)]
[$vector-ref $vector-ref-label (core-prim . $vector-ref)]
[$vector-set! $vector-set!-label (core-prim . $vector-set!)]
2007-04-29 18:35:18 -04:00
;;; iterators
[for-each for-each-label (core-prim . for-each)]
[map map-label (core-prim . map)]
2007-04-29 18:35:18 -04:00
[andmap andmap-label (core-prim . andmap)]
[ormap ormap-label (core-prim . ormap)]
;;; fixnums
2007-04-29 05:02:44 -04:00
[fixnum? fixnum-label (core-prim . fixnum?)]
[fx< fx<-label (core-prim . fx<)]
[fx<= fx<=-label (core-prim . fx<=)]
[fx> fx>-label (core-prim . fx>)]
[fx>= fx>=-label (core-prim . fx>=)]
[fx= fx=-label (core-prim . fx=)]
[fx- fx--label (core-prim . fx-)]
[fx+ fx+-label (core-prim . fx+)]
2007-04-29 22:29:42 -04:00
[fx* fx*-label (core-prim . fx*)]
[fxzero? fxzero?-label (core-prim . fxzero?)]
2007-04-29 05:02:44 -04:00
[fxadd1 fxadd1-label (core-prim . fxadd1)]
[fxsub1 fxsub1-label (core-prim . fxsub1)]
2007-04-29 18:35:18 -04:00
[fxquotient fxquotient-label (core-prim . fxquotient)]
[fxremainder fxremainder-label (core-prim . fxremainder)]
2007-04-30 00:31:21 -04:00
[fxmodulo fxmodulo-label (core-prim . fxmodulo)]
2007-04-29 21:25:31 -04:00
[fxsll fxsll-label (core-prim . fxsll)]
[fxsra fxsra-label (core-prim . fxsra)]
[fxlogand fxlogand-label (core-prim . fxlogand)]
2007-04-30 00:31:21 -04:00
[fxlogxor fxlogxor-label (core-prim . fxlogxor)]
2007-04-29 21:25:31 -04:00
[fxlogor fxlogor-label (core-prim . fxlogor)]
[fxlognot fxlognot-label (core-prim . fxlognot)]
2007-04-30 00:31:21 -04:00
[fixnum->string fixnum->string-label (core-prim . fixnum->string)]
[$fxzero? $fxzero?-label (core-prim . $fxzero?)]
2007-04-29 23:00:20 -04:00
[$fxadd1 $fxadd1-label (core-prim . $fxadd1)]
2007-04-30 00:31:21 -04:00
[$fxsub1 $fxsub1-label (core-prim . $fxsub1)]
2007-04-29 21:42:41 -04:00
[$fx>= $fx>=-label (core-prim . $fx>=)]
2007-04-30 00:31:21 -04:00
[$fx<= $fx<=-label (core-prim . $fx<=)]
[$fx> $fx>-label (core-prim . $fx>)]
[$fx< $fx<-label (core-prim . $fx<)]
2007-04-29 23:00:20 -04:00
[$fx= $fx=-label (core-prim . $fx=)]
2007-04-29 23:13:19 -04:00
[$fxsll $fxsll-label (core-prim . $fxsll)]
[$fxsra $fxsra-label (core-prim . $fxsra)]
2007-04-30 00:31:21 -04:00
[$fxquotient $fxquotient-label (core-prim . $fxquotient)]
[$fxmodulo $fxmodulo-label (core-prim . $fxmodulo)]
2007-04-29 23:13:19 -04:00
[$fxlogxor $fxlogxor-label (core-prim . $fxlogxor)]
2007-04-30 00:31:21 -04:00
[$fxlogor $fxlogor-label (core-prim . $fxlogor)]
2007-04-29 23:13:19 -04:00
[$fxlognot $fxlognot-label (core-prim . $fxlognot)]
[$fxlogand $fxlogand-label (core-prim . $fxlogand)]
2007-04-29 23:00:20 -04:00
[$fx+ $fx+-label (core-prim . $fx+)]
2007-04-30 00:31:21 -04:00
[$fx* $fx*-label (core-prim . $fx*)]
2007-04-29 23:00:20 -04:00
[$fx- $fx--label (core-prim . $fx-)]
2007-04-29 22:29:42 -04:00
;;; flonum
[string->flonum string->flonum-label (core-prim . string->flonum)]
2007-04-29 18:35:18 -04:00
;;; generic arithmetic
[- minus-label (core-prim . -)]
2007-04-30 00:31:21 -04:00
[= =-label (core-prim . =)]
[< <-label (core-prim . <)]
[> >-label (core-prim . >)]
[<= <=-label (core-prim . <=)]
[>= >=-label (core-prim . >=)]
[* *-label (core-prim . *)]
[+ plus-label (core-prim . +)]
2007-04-29 23:00:20 -04:00
[number? number?-label (core-prim . number?)]
[quotient quotient-label (core-prim . quotient)]
2007-04-29 23:00:20 -04:00
[number->string number->string-label (core-prim . number->string)]
2007-04-30 00:31:21 -04:00
[string->number string->number-label (core-prim . string->number)]
2007-04-29 18:35:18 -04:00
;;; symbols/gensyms
[symbol? symbol?-label (core-prim . symbol?)]
2007-04-29 21:25:31 -04:00
[gensym? gensym?-label (core-prim . gensym?)]
2007-04-29 18:35:18 -04:00
[gensym gensym-label (core-prim . gensym)]
[getprop getprop-label (core-prim . getprop)]
[putprop putprop-label (core-prim . putprop)]
2007-04-30 00:31:21 -04:00
[remprop remprop-label (core-prim . remprop)]
[property-list property-list-label (core-prim . property-list)]
2007-04-29 22:29:42 -04:00
[string->symbol string->symbol-label (core-prim . string->symbol)]
2007-04-29 21:25:31 -04:00
[symbol->string symbol->string-label (core-prim . symbol->string)]
[gensym->unique-string gensym->unique-string-label (core-prim . gensym->unique-string)]
2007-04-30 00:31:21 -04:00
[$make-symbol $make-symbol-label (core-prim . $make-symbol)]
[$symbol-unique-string $symbol-unique-string-label (core-prim . $symbol-unique-string)]
[$symbol-value $symbol-value-label (core-prim . $symbol-value)]
[$symbol-string $symbol-string-label (core-prim . $symbol-string)]
[$symbol-plist $symbol-plist-label (core-prim . $symbol-plist)]
2007-04-29 21:25:31 -04:00
[$set-symbol-value! $set-symbol-value!-label (core-prim . $set-symbol-value!)]
2007-04-30 00:31:21 -04:00
[$set-symbol-string! $set-symbol-string!-label (core-prim . $set-symbol-string!)]
[$set-symbol-unique-string! $set-symbol-unique-string!-label (core-prim . $set-symbol-unique-string!)]
[$set-symbol-plist! $set-symbol-plist!-label (core-prim . $set-symbol-plist!)]
2007-04-29 20:55:51 -04:00
;;; top-level
[top-level-bound? top-level-bound-label (core-prim . top-level-bound?)]
[top-level-value top-level-value-label (core-prim . top-level-value)]
[set-top-level-value! set-top-level-value!-label (core-prim . set-top-level-value!)]
2007-04-29 18:35:18 -04:00
;;; IO/ports
[output-port? output-port?-label (core-prim . output-port?)]
2007-04-29 22:29:42 -04:00
[input-port? input-port?-label (core-prim . input-port?)]
2007-04-29 23:00:20 -04:00
[input-port-name input-port-name-label (core-prim . input-port-name)]
[output-port-name output-port-name-label (core-prim . output-port-name)]
2007-04-29 22:29:42 -04:00
[open-input-file open-input-file-label (core-prim . open-input-file)]
2007-04-29 23:00:20 -04:00
[open-output-file open-output-file-label (core-prim . open-output-file)]
[open-output-string open-output-string-label (core-prim . open-output-string)]
[get-output-string get-output-string-label (core-prim . get-output-string)]
2007-04-29 22:29:42 -04:00
[close-input-port close-input-port-label (core-prim . close-input-port)]
[console-input-port console-input-port-label (core-prim . console-input-port)]
2007-04-29 18:35:18 -04:00
[console-output-port console-output-port-label (core-prim . console-output-port)]
[current-input-port current-input-port-label (core-prim . current-input-port)]
[current-output-port current-output-port-label (core-prim . current-output-port)]
2007-04-29 23:00:20 -04:00
[standard-input-port standard-input-port-label (core-prim . standard-input-port)]
[standard-output-port standard-output-port-label (core-prim . standard-output-port)]
[standard-error-port standard-error-port-label (core-prim . standard-error-port)]
[flush-output-port flush-output-port-label (core-prim . flush-output-port)]
[reset-input-port! reset-input-port!-label (core-prim . reset-input-port!)]
2007-04-29 18:35:18 -04:00
;;; IO/high-level
[display display-label (core-prim . display)]
[write write-label (core-prim . write)]
2007-04-29 20:55:51 -04:00
[write-char write-char-label (core-prim . write-char)]
2007-04-29 18:35:18 -04:00
[read read-label (core-prim . read)]
2007-04-29 21:25:31 -04:00
[read-char read-char-label (core-prim . read-char)]
2007-04-29 22:29:42 -04:00
[read-token read-token-label (core-prim . read-token)]
[peek-char peek-char-label (core-prim . peek-char)]
[unread-char unread-char-label (core-prim . unread-char)]
2007-04-29 18:35:18 -04:00
[newline newline-label (core-prim . newline)]
[printf printf-label (core-prim . printf)]
[format format-label (core-prim . format)]
2007-04-29 18:35:18 -04:00
[pretty-print pretty-print-label (core-prim . pretty-print)]
2007-04-29 22:29:42 -04:00
[comment-handler comment-handler-label (core-prim . comment-handler)]
2007-04-29 23:00:20 -04:00
[print-gensym print-gensym-label (core-prim . print-gensym)]
2007-04-30 00:31:21 -04:00
[gensym-count gensym-count-label (core-prim . gensym-count)]
[gensym-prefix gensym-prefix-label (core-prim . gensym-prefix)]
2007-04-29 21:25:31 -04:00
;;; hash tables
[make-hash-table make-hash-table-label (core-prim . make-hash-table)]
2007-04-29 23:00:20 -04:00
[hash-table? hash-table?-label (core-prim . hash-table?)]
2007-04-29 21:25:31 -04:00
[get-hash-table get-hash-table-label (core-prim . get-hash-table)]
[put-hash-table! put-hash-table!-label (core-prim . put-hash-table!)]
2007-04-29 18:35:18 -04:00
;;; evaluation / control
2007-04-29 22:29:42 -04:00
[make-parameter make-parameter-label (core-prim . make-parameter)]
2007-04-29 18:35:18 -04:00
[apply apply-label (core-prim . apply)]
[values values-label (core-prim . values)]
[call-with-values cwv-label (core-prim . call-with-values)]
[current-eval current-eval-label (core-prim . current-eval)]
2007-04-29 18:35:18 -04:00
[call/cc call/cc-label (core-prim . call/cc)]
2007-04-29 20:55:51 -04:00
[call/cf call/cf-label (core-prim . call/cf)]
2007-04-29 18:35:18 -04:00
[dynamic-wind dynamic-wind-label (core-prim . dynamic-wind)]
2007-04-29 05:02:44 -04:00
[error error-label (core-prim . error)]
2007-04-29 18:35:18 -04:00
[print-error print-error-label (core-prim . print-error)]
[error-handler error-handler-label (core-prim . error-handler)]
[interrupt-handler interrupt-handler-label (core-prim . interrupt-handler)]
2007-04-29 05:02:44 -04:00
[exit exit-label (core-prim . exit)]
[compile compile-label (core-prim . compile)]
2007-04-29 18:35:18 -04:00
[eval eval-label (core-prim . eval)]
[load load-label (core-prim . load)]
[new-cafe new-cafe-label (core-prim . new-cafe)]
[command-line-arguments command-line-arguments-label (core-prim . command-line-arguments)]
2007-04-29 21:25:31 -04:00
;;; record/mid-level
[record? record?-label (core-prim . record?)]
2007-04-29 23:13:19 -04:00
[make-record-type make-record-type-label (core-prim . make-record-type)]
2007-04-29 21:25:31 -04:00
[record-type-descriptor record-type-descriptor-label (core-prim . record-type-descriptor)]
[record-type-field-names record-type-field-names-label (core-prim . record-type-field-names)]
[record-type-symbol record-type-symbol-label (core-prim . record-type-symbol)]
[record-type-name record-type-name-label (core-prim . record-type-name)]
2007-04-29 23:00:20 -04:00
[record-name record-name-label (core-prim . record-name)]
2007-04-29 23:13:19 -04:00
[record-constructor record-constructor-label (core-prim . record-constructor)]
[record-predicate record-predicate-labe (core-prim . record-predicate)]
[record-length record-length-label (core-prim . record-length)]
[record-printer record-printer-label (core-prim . record-printer)]
[record-ref record-ref-label (core-prim . record-ref)]
2007-04-29 21:25:31 -04:00
[record-field-accessor record-field-accessor-label (core-prim . record-field-accessor)]
[record-field-mutator record-field-mutator-label (core-prim . record-field-mutator)]
2007-04-29 18:35:18 -04:00
;;; records/low-level
2007-04-29 21:25:31 -04:00
[$base-rtd $base-rtd-label (core-prim . $base-rtd)]
[$record-set! $record-set!-label (core-prim . $record-set!)]
[$record-ref $record-ref-label (core-prim . $record-ref)]
2007-04-30 00:47:37 -04:00
[$record-rtd $record-rtd-label (core-prim . $record-rtd)]
[$record $record-label (core-prim . $record)]
2007-04-30 00:47:37 -04:00
[$make-record $make-record-label (core-prim . $make-record)]
[$record? $record?-label (core-prim . $record?)]
[$record/rtd? $record/rtd?-label (core-prim . $record/rtd?)]
2007-04-29 21:25:31 -04:00
;;; codes
[$closure-code $closure-code-label (core-prim . $closure-code)]
2007-04-29 21:42:41 -04:00
[$code? $code?-label (core-prim . $code?)]
[$code-reloc-vector $code-reloc-vector-label (core-prim . $code-reloc-vector)]
[$code-freevars $code-freevars-label (core-prim . $code-freevars)]
[$code-size $code-size-label (core-prim . $code-size)]
[$code-ref $code-ref-label (core-prim . $code-ref)]
[$code-set! $code-set!-label (core-prim . $code-set!)]
2007-04-29 21:25:31 -04:00
[code? code?-label (core-prim . code?)]
[code-reloc-vector code-reloc-vector-label (core-prim . code-reloc-vector)]
[code-size code-size-label (core-prim . code-size)]
[code-freevars code-freevars-label (core-prim . code-freevars)]
[code-ref code-ref-label (core-prim . code-ref)]
2007-04-29 21:42:41 -04:00
[code-set! code-set!-label (core-prim . code-set!)]
2007-04-29 23:13:19 -04:00
;;; tcbuckets
[$make-tcbucket $make-tcbucket-label (core-prim . $make-tcbucket)]
[$tcbucket-key $tcbucket-key-label (core-prim . $tcbucket-key)]
[$tcbucket-val $tcbucket-val-label (core-prim . $tcbucket-val)]
[$tcbucket-next $tcbucket-next-label (core-prim . $tcbucket-next)]
[$set-tcbucket-val! $set-tcbucket-val!-label (core-prim . $set-tcbucket-val!)]
[$set-tcbucket-next! $set-tcbucket-next!-label (core-prim . $set-tcbucket-next!)]
[$set-tcbucket-tconc! $set-tcbucket-tconc!-label (core-prim . $set-tcbucket-tconc!)]
2007-04-29 18:35:18 -04:00
;;; misc
2007-04-29 21:25:31 -04:00