psyntax 最新版への道 4
define-record を自前で展開。
(define library-rtd (make-record-type-descriptor 'library #f #f #f #f '#( (mutable id) (mutable name) (mutable version) (mutable imp*) (mutable vis*) (mutable inv*) (mutable subst) (mutable env) (mutable visit-state) (mutable invoke-state) (mutable visit-code) (mutable invoke-code) (mutable visible?) (mutable source-file-name)))) (define library-rcd (make-record-constructor-descriptor library-rtd #f #f)) (define make-library (record-constructor library-rcd)) (define library? (record-predicate library-rtd)) (define library-id (record-accessor library-rtd 0)) (define library-name (record-accessor library-rtd 1)) (define library-version (record-accessor library-rtd 2)) (define library-imp* (record-accessor library-rtd 3)) (define library-vis* (record-accessor library-rtd 4)) (define library-inv* (record-accessor library-rtd 5)) (define library-subst (record-accessor library-rtd 6)) (define library-env (record-accessor library-rtd 7)) (define library-visit-state (record-accessor library-rtd 8)) (define library-invoke-state (record-accessor library-rtd 9)) (define library-visit-code (record-accessor library-rtd 10)) (define library-invoke-code (record-accessor library-rtd 11)) (define library-visible? (record-accessor library-rtd 12)) (define library-source-file-name (record-accessor library-rtd 13))
次は fprintf が unbound だと。(mosh string) をimport して format に変える。
expander まで進んだよ。
expanding psyntax/expander-mosh.ss Condition components: 1. &error 2. &who: expander 3. &message: "unbound identifier" 4. &irritants: ((stx? sym))
Condition components: 1. &error 2. &message: "undefined prim ~s" 3. &irritants: (null?)
psyntax-buildscript-mosh.ss の define-prims に追記。
null? cdr car pair? vector eq? bound-identifier=? reverse
Condition components: 1. &error 2. &who: expander 3. &message: "unbound identifier" 4. &irritants: ((make-rib '() '() '() #f))
さてまた define-record を展開する。
その次。
expanding psyntax-rev10/expander.ss Condition components: 1. &error 2. &who: expander 3. &message: "unbound identifier" 4. &irritants: ((x old* new*))
(let*-values ([(x old* new*) (rename (car x*) old* new*)] [(x* old* new*) (rename* (cdr x*) old* new*)])
let-values* 問題。let-values に展開した。
Condition components: 1. &error 2. &who: expander 3. &message: "unbound identifier" 4. &irritants: ((make-module-interface (car
(define-record module-interface (first-mark exp-id-vec exp-lab-vec))
展開展開。
大分進んだ。
expanding psyntax-rev10/main.ss Condition components: 1. &error 2. &who: expander 3. &message: "unbound identifier" 4. &irritants: ((get-command-line))
バックエンドから get-command-line でとるようになったのだね。
Mosh は command-line を提供しているので。
(rename (rnrs programs) (command-line get-command-line))
としてやればよい。
3. &message: "unbound identifier" 4. &irritants: ((get-directory-name filename))
(define (local-library-path filename) (cons (get-directory-name filename) (library-path)))
ここでしか使われていないのでとりあえず
(define (local-library-path filename) (cons "." (library-path)))
展開できたよー。
~/mosh/mosh -b psyntax-buildscript-mosh.ss
expanding psyntax-rev10/compat.ss
expanding psyntax-rev10/internal.ss
expanding psyntax-rev10/config.ss
expanding psyntax-rev10/library-manager.ss
expanding psyntax-rev10/builders.ss
expanding psyntax-rev10/expander.ss
expanding /Users/taro/mosh/lib/mosh/condition.ss
expanding /Users/taro/mosh/lib/mosh/io/conditions.ss
expanding /Users/taro/mosh/lib/mosh/unicode.ss
expanding psyntax-rev10/main.ss
Happy Happy Joy Joy
使ってみる。
dorami% ~/mosh/mosh psyntax.scm Exception: Unhandled exception Condition components: 1. &assertion 2. &who: (lambda G12971id G12972name G12973ver G12974imp* G12975vis* G12976inv* G12977exp-subst G12978exp-env G12974 3. &message: "wrong number of arguments (required 14, got 11)" 4. &irritants: ()
ああ。怒られました。続きはまた後で。