* Added basic identifier-syntax (one that does not recognize the
set! case).
This commit is contained in:
parent
af9798e9be
commit
d2657bde24
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -12,7 +12,6 @@
|
||||||
(ikarus fasl write))
|
(ikarus fasl write))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define-syntax record-case
|
(define-syntax record-case
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(define (enumerate fld* i)
|
(define (enumerate fld* i)
|
||||||
|
@ -5289,53 +5288,19 @@
|
||||||
(define eval-core
|
(define eval-core
|
||||||
(lambda (x) ((compile-core-expr x))))
|
(lambda (x) ((compile-core-expr x))))
|
||||||
|
|
||||||
|
;(include "libaltcogen.ss")
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#!eof junk
|
#!eof junk
|
||||||
|
|
||||||
|
|
||||||
(define (compile-expr->code x)
|
|
||||||
(compile-core-expr->code
|
|
||||||
(parameterize ([assembler-output #f])
|
|
||||||
(expand x))))
|
|
||||||
|
|
||||||
(define compile
|
|
||||||
(lambda (x)
|
|
||||||
(let ([code
|
|
||||||
(if (code? x)
|
|
||||||
x
|
|
||||||
(compile-expr->code x))])
|
|
||||||
(let ([proc ($code->closure code)])
|
|
||||||
(proc)))))
|
|
||||||
|
|
||||||
(define compile-file
|
|
||||||
(lambda (input-file output-file . rest)
|
|
||||||
(let ([ip (open-input-file input-file)]
|
|
||||||
[op (apply open-output-file output-file rest)])
|
|
||||||
(let f ()
|
|
||||||
(let ([x (read ip)])
|
|
||||||
(unless (eof-object? x)
|
|
||||||
(fasl-write (compile-expr->code x) op)
|
|
||||||
(f))))
|
|
||||||
(close-input-port ip)
|
|
||||||
(close-output-port op))))
|
|
||||||
|
|
||||||
;(include "libaltcogen.ss")
|
|
||||||
(define alt-cogen
|
(define alt-cogen
|
||||||
(lambda args
|
(lambda args
|
||||||
(error 'alt-cogen "disabled for now")))
|
(error 'alt-cogen "disabled for now")))
|
||||||
|
|
||||||
(define alt-compile-file
|
|
||||||
(lambda (input-file output-file . rest)
|
|
||||||
(let ([ip (open-input-file input-file)]
|
|
||||||
[op (apply open-output-file output-file rest)])
|
|
||||||
(let f ()
|
|
||||||
(let ([x (read ip)])
|
|
||||||
(unless (eof-object? x)
|
|
||||||
(fasl-write (alt-compile-expr x) op)
|
|
||||||
(f))))
|
|
||||||
(close-input-port ip)
|
|
||||||
(close-output-port op))))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@
|
||||||
(stx-error e "unbound identifier"))
|
(stx-error e "unbound identifier"))
|
||||||
(case type
|
(case type
|
||||||
[(lexical core-prim macro global local-macro
|
[(lexical core-prim macro global local-macro
|
||||||
global-macro displaced-lexical syntax)
|
global-macro displaced-lexical syntax import)
|
||||||
(values type (binding-value b) id)]
|
(values type (binding-value b) id)]
|
||||||
[else (values 'other #f #f)])))]
|
[else (values 'other #f #f)])))]
|
||||||
[(syntax-pair? e)
|
[(syntax-pair? e)
|
||||||
|
@ -427,7 +427,7 @@
|
||||||
(case type
|
(case type
|
||||||
[(define define-syntax core-macro begin macro
|
[(define define-syntax core-macro begin macro
|
||||||
local-macro global-macro module set!
|
local-macro global-macro module set!
|
||||||
let-syntax letrec-syntax)
|
let-syntax letrec-syntax import)
|
||||||
(values type (binding-value b) id)]
|
(values type (binding-value b) id)]
|
||||||
[else
|
[else
|
||||||
(values 'call #f #f)]))
|
(values 'call #f #f)]))
|
||||||
|
@ -783,6 +783,15 @@
|
||||||
(bless `(letrec ([,f (lambda ,lhs* ,b . ,b*)])
|
(bless `(letrec ([,f (lambda ,lhs* ,b . ,b*)])
|
||||||
(,f . ,rhs*)))
|
(,f . ,rhs*)))
|
||||||
(stx-error stx "invalid syntax"))])))
|
(stx-error stx "invalid syntax"))])))
|
||||||
|
(define identifier-syntax-macro
|
||||||
|
(lambda (stx)
|
||||||
|
(syntax-match stx ()
|
||||||
|
[(_ expr)
|
||||||
|
(bless `(lambda (x)
|
||||||
|
(syntax-case x ()
|
||||||
|
[id (identifier? #'id) #',expr]
|
||||||
|
[(id e* ...) (identifier? #'id)
|
||||||
|
(cons #',expr #'(e* ...))])))])))
|
||||||
(define do-macro
|
(define do-macro
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(define bind
|
(define bind
|
||||||
|
@ -1554,6 +1563,7 @@
|
||||||
[(syntax-rules) syntax-rules-macro]
|
[(syntax-rules) syntax-rules-macro]
|
||||||
[(quasiquote) quasiquote-macro]
|
[(quasiquote) quasiquote-macro]
|
||||||
[(with-syntax) with-syntax-macro]
|
[(with-syntax) with-syntax-macro]
|
||||||
|
[(identifier-syntax) identifier-syntax-macro]
|
||||||
[else (error 'macro-transformer "invalid macro ~s" x)])]
|
[else (error 'macro-transformer "invalid macro ~s" x)])]
|
||||||
[else (error 'core-macro-transformer "invalid macro ~s" x)])))
|
[else (error 'core-macro-transformer "invalid macro ~s" x)])))
|
||||||
(define (local-macro-transformer x)
|
(define (local-macro-transformer x)
|
||||||
|
|
|
@ -469,8 +469,8 @@
|
||||||
(make-seq (seq* e* ...) e)]))
|
(make-seq (seq* e* ...) e)]))
|
||||||
|
|
||||||
|
|
||||||
(include "pass-specify-rep.ss")
|
|
||||||
|
|
||||||
|
(include "pass-specify-rep.ss")
|
||||||
|
|
||||||
(define parameter-registers '(%edi))
|
(define parameter-registers '(%edi))
|
||||||
(define return-value-register '%eax)
|
(define return-value-register '%eax)
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
[define-syntax (define-syntax)]
|
[define-syntax (define-syntax)]
|
||||||
[module (module)]
|
[module (module)]
|
||||||
[begin (begin)]
|
[begin (begin)]
|
||||||
|
[import (import)]
|
||||||
[set! (set!)]
|
[set! (set!)]
|
||||||
[let-syntax (let-syntax)]
|
[let-syntax (let-syntax)]
|
||||||
[letrec-syntax (letrec-syntax)]
|
[letrec-syntax (letrec-syntax)]
|
||||||
|
@ -101,6 +102,7 @@
|
||||||
[syntax-rules (macro . syntax-rules)]
|
[syntax-rules (macro . syntax-rules)]
|
||||||
[quasiquote (macro . quasiquote)]
|
[quasiquote (macro . quasiquote)]
|
||||||
[with-syntax (macro . with-syntax)]
|
[with-syntax (macro . with-syntax)]
|
||||||
|
[identifier-syntax (macro . identifier-syntax)]
|
||||||
[let (macro . let)]
|
[let (macro . let)]
|
||||||
[let* (macro . let*)]
|
[let* (macro . let*)]
|
||||||
[cond (macro . cond)]
|
[cond (macro . cond)]
|
||||||
|
@ -188,6 +190,7 @@
|
||||||
[letrec-syntax i r]
|
[letrec-syntax i r]
|
||||||
[module i cm]
|
[module i cm]
|
||||||
[begin i r]
|
[begin i r]
|
||||||
|
[import i]
|
||||||
[set! i r]
|
[set! i r]
|
||||||
[foreign-call i]
|
[foreign-call i]
|
||||||
[quote i r]
|
[quote i r]
|
||||||
|
@ -210,6 +213,7 @@
|
||||||
[quasiquote i r]
|
[quasiquote i r]
|
||||||
[with-syntax i syncase]
|
[with-syntax i syncase]
|
||||||
[let i r]
|
[let i r]
|
||||||
|
[identifier-syntax i r]
|
||||||
[let* i r]
|
[let* i r]
|
||||||
[cond i r]
|
[cond i r]
|
||||||
[do i r]
|
[do i r]
|
||||||
|
|
|
@ -29,11 +29,10 @@
|
||||||
(putprop x cookie v))
|
(putprop x cookie v))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(module (specify-representation)
|
(module (specify-representation)
|
||||||
(import object-representation)
|
(import object-representation)
|
||||||
(import primops)
|
(import primops)
|
||||||
(define-record PH
|
(define-record PH
|
||||||
(interruptable? p-handler p-handled? v-handler v-handled? e-handler e-handled?))
|
(interruptable? p-handler p-handled? v-handler v-handled? e-handler e-handled?))
|
||||||
(define interrupt-handler
|
(define interrupt-handler
|
||||||
(make-parameter (lambda () (error 'interrupt-handler "uninitialized"))))
|
(make-parameter (lambda () (error 'interrupt-handler "uninitialized"))))
|
||||||
|
@ -179,10 +178,10 @@
|
||||||
(define-syntax define-primop
|
(define-syntax define-primop
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(define (cogen-name stx name suffix)
|
(define (cogen-name stx name suffix)
|
||||||
(datum->syntax-object stx
|
(datum->syntax stx
|
||||||
(string->symbol
|
(string->symbol
|
||||||
(format "cogen-~a-~a" suffix
|
(format "cogen-~a-~a" suffix
|
||||||
(syntax-object->datum name)))))
|
(syntax->datum name)))))
|
||||||
(define (generate-handler name ctxt case*)
|
(define (generate-handler name ctxt case*)
|
||||||
(define (filter-cases case*)
|
(define (filter-cases case*)
|
||||||
(syntax-case case* ()
|
(syntax-case case* ()
|
||||||
|
|
Loading…
Reference in New Issue