Skip to content

Instantly share code, notes, and snippets.

@stibear
Created February 7, 2014 18:09
Show Gist options
  • Save stibear/8868358 to your computer and use it in GitHub Desktop.
Save stibear/8868358 to your computer and use it in GitHub Desktop.
cd src; \
yacc -d parse.y; \
flex scan.l
cc -Wall -Wextra -std=c99 -g -DDEBUG=1 -O0 -shared -fPIC src/*.c -o lib/libpicrin.so -I./include -I./extlib -L./lib -lm -lxfile
src/codegen.c: 関数 ‘global_def’ 内:
src/codegen.c:1467:38: 警告: 符号付きと符号無しの整数式の間での比較です [-Wsign-compare]
if ((gidx = global_ref(pic, name)) != -1) {
^
lex.yy.c: 関数 ‘yy_scan_bytes’ 内:
lex.yy.c:1857:17: 警告: 符号付きと符号無しの整数式の間での比較です [-Wsign-compare]
cc -Wall -Wextra -std=c99 -g -DDEBUG=1 -O0 -D_GNU_SOURCE -Wl,-rpath lib tools/main.c -o bin/picrin -I./include -I./extlib -L./lib -lreadline -lm -lxfile -lpicrin
bin/picrin
gc run!
sym_pool realloced
gc run!
gc run!
gc run!
sym_pool realloced
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
ai = 1
# input expression
(define-library (picrin macro) (import (scheme base)) (define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env)))) (define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env)))) (export sc-macro-transformer rsc-macro-transformer))
ai = 1
before expand:
(define-library (picrin macro) (import (scheme base)) (define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env)))) (define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env)))) (export sc-macro-transformer rsc-macro-transformer))
[macroexpand] expanding... (define-library (picrin macro) (import (scheme base)) (define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env)))) (define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env)))) (export sc-macro-transformer rsc-macro-transformer))
[macroexpand] expanding... define-library
* reopen library: (picrin macro)
ai = 1
# input expression
(import (scheme base))
ai = 1
before expand:
(import (scheme base))
[macroexpand] expanding... (import (scheme base))
[macroexpand] expanding... import
* importing file-error? as file-error?@145
* importing char? as char?@134
* importing vector-set! as vector-set!@123
* importing procedure? as procedure?@112
* importing truncate-remainder as truncate-remainder@75
* importing negative? as negative?@62
* importing exact-integer? as exact-integer?@54
* importing peek-char as peek-char@43
* importing textual-port? as textual-port?@32
* importing append as append@21
* importing cddr as cddr@15
* importing eqv? as eqv?@2
* importing define
* importing string=? as string=?@151
* importing error as error@140
* importing call-with-current-continuation as call-with-current-continuation@129
* importing string->symbol as string->symbol@118
* importing round as round@81
* importing = as =@55
* importing real? as real?@49
* importing eof-object as eof-object@38
* importing current-input-port as current-input-port@27
* importing set-car! as set-car!@10
* importing lambda
* importing string? as string?@146
* importing char->integer as char->integer@135
* importing bytevector? as bytevector?@124
* importing apply as apply@113
* importing gcd as gcd@76
* importing odd? as odd?@63
* importing < as <@56
* importing newline as newline@44
* importing binary-port? as binary-port?@33
* importing reverse as reverse@22
* importing equal? as equal?@3
* importing if
* importing string<? as string<?@152
* importing error-object? as error-object?@141
* importing call/cc as call/cc@130
* importing vector? as vector?@119
* importing square as square@82
* importing abs as abs@71
* importing <= as <=@58
* importing rational? as rational?@50
* importing close-port as close-port@39
* importing current-output-port as current-output-port@28
* importing list? as list?@17
* importing set-cdr! as set-cdr!@11
* importing cons as cons@7
* importing begin
* importing make-string as make-string@147
* importing integer->char as integer->char@136
* importing make-bytevector as make-bytevector@125
* importing map as map@114
* importing lcm as lcm@77
* importing even? as even?@64
* importing > as >@57
* importing write-char as write-char@45
* importing port? as port?@34
* importing list-tail as list-tail@23
* importing car as car@8
* importing set!
* importing string>? as string>?@153
* importing error-object-message as error-object-message@142
* importing dynamic-wind as dynamic-wind@131
* importing make-vector as make-vector@120
* importing expt as expt@83
* importing floor-quotient as floor-quotient@72
* importing >= as >=@59
* importing integer? as integer?@51
* importing close-input-port as close-input-port@40
* importing current-error-port as current-error-port@29
* importing make-list as make-list@18
* importing caar as caar@12
* importing cdr as cdr@9
* importing boolean? as boolean?@5
* importing quote
* importing string-length as string-length@148
* importing with-exception-handler as with-exception-handler@137
* importing bytevector-length as bytevector-length@126
* importing for-each as for-each@115
* importing floor as floor@78
* importing min as min@65
* importing flush-output-port as flush-output-port@46
* importing input-port-open? as input-port-open?@35
* importing list-ref as list-ref@24
* importing null? as null?@16
* importing not as not@4
* importing string<=? as string<=?@154
* importing error-object-irritants as error-object-irritants@143
* importing values as values@132
* importing vector-length as vector-length@121
* importing inexact as inexact@84
* importing floor-remainder as floor-remainder@73
* importing + as +@67
* importing zero? as zero?@60
* importing exact? as exact?@52
* importing close-output-port as close-output-port@41
* importing input-port? as input-port?@30
* importing list as list@19
* importing cadr as cadr@13
* importing pair? as pair?@6
* importing string-ref as string-ref@149
* importing raise as raise@138
* importing bytevector-u8-ref as bytevector-u8-ref@127
* importing symbol? as symbol?@116
* importing ceiling as ceiling@79
* importing - as -@68
* importing max as max@66
* importing number? as number?@47
* importing output-port-open? as output-port-open?@36
* importing list-set! as list-set!@25
* importing string>=? as string>=?@155
* importing read-error? as read-error?@144
* importing call-with-values as call-with-values@133
* importing vector-ref as vector-ref@122
* importing exact as exact@85
* importing truncate-quotient as truncate-quotient@74
* importing * as *@69
* importing positive? as positive?@61
* importing inexact? as inexact?@53
* importing read-char as read-char@42
* importing output-port? as output-port?@31
* importing length as length@20
* importing cdar as cdar@14
* importing eq? as eq?@1
* importing define-syntax
* importing load as load@165
* importing string-set! as string-set!@150
* importing raise-continuable as raise-continuable@139
* importing bytevector-u8-set! as bytevector-u8-set!@128
* importing symbol->string as symbol->string@117
* importing truncate as truncate@80
* importing / as /@70
* importing complex? as complex?@48
* importing eof-object? as eof-object?@37
* importing list-copy as list-copy@26
* importing define-macro
after expand:
#f
## macroexpand completed
#f
ai = 1
## analyzer completed
(return (quote #f))
ai = 3
## resolver completed
(return (quote #f))
ai = 4
## codegen completed
## irep 0x6889c0
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x688980>
argv = ()
irep = ## irep 0x6889c0
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 3
# input expression
(define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env))))
ai = 3
before expand:
(define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env))))
[macroexpand] expanding... (define (sc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env))))
[macroexpand] expanding... define
[macroexpand] expanding... ()
[macroexpand] expanding... (lambda (expr use-env mac-env) (make-syntactic-closure mac-env (quote ()) (f expr use-env)))
[macroexpand] expanding... lambda
[macroexpand] expanding... ()
[macroexpand] expanding... (make-syntactic-closure mac-env (quote ()) (f expr use-env))
[macroexpand] expanding... make-syntactic-closure
[macroexpand] expanding... mac-env
[macroexpand] expanding... (quote ())
[macroexpand] expanding... quote
[macroexpand] expanding... (f expr use-env)
[macroexpand] expanding... f
[macroexpand] expanding... expr
[macroexpand] expanding... use-env
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... expr
[macroexpand] expanding... use-env
[macroexpand] expanding... mac-env
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... sc-macro-transformer
[macroexpand] expanding... f
[macroexpand] expanding... ()
after expand:
(define (sc-macro-transformer@168 f@167) (lambda (expr@169 use-env@170 mac-env@171) (make-syntactic-closure@156 mac-env@171 (quote ()) (f@167 expr@169 use-env@170))))
## macroexpand completed
(define (sc-macro-transformer@168 f@167) (lambda (expr@169 use-env@170 mac-env@171) (make-syntactic-closure@156 mac-env@171 (quote ()) (f@167 expr@169 use-env@170))))
ai = 4
gc run!
gc run!
## analyzer completed
(return (set! (ref 0 sc-macro-transformer@168) (lambda (f@167) () #f (f@167) (return (lambda (expr@169 use-env@170 mac-env@171) () #f () (tail-call (ref 2 make-syntactic-closure@156) (ref 0 mac-env@171) (quote ()) (call (ref 1 f@167) (ref 0 expr@169) (ref 0 use-env@170))))))))
ai = 6
gc run!
gc run!
gc run!
gc run!
gc run!
gc run!
## resolver completed
(return (set! (gref 166) (lambda (f@167) () #f (f@167) (return (lambda (expr@169 use-env@170 mac-env@171) () #f () (tail-call (gref 155) (lref 3) (quote ()) (call (cref 1 0) (lref 1) (lref 2))))))))
ai = 7
## codegen completed
## irep 0x68c490
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 166
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68c510
[clen = 2, argc = 2, localc = 0]
:: cv_num = 1
: 1 -> 0
00 [20] OP_LAMBDA 0
01 [19] OP_RET
## irep 0x68c590
[clen = 8, argc = 4, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 155
01 [10] OP_LREF 3
02 [ 2] OP_PUSHNIL
03 [12] OP_CREF 1 0
04 [10] OP_LREF 1
05 [10] OP_LREF 2
06 [17] OP_CALL 3
07 [18] OP_TAILCALL 4
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x68c450>
argv = ()
irep = ## irep 0x68c490
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 166
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68c510
[clen = 2, argc = 2, localc = 0]
:: cv_num = 1
: 1 -> 0
00 [20] OP_LAMBDA 0
01 [19] OP_RET
## irep 0x68c590
[clen = 8, argc = 4, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 155
01 [10] OP_LREF 3
02 [ 2] OP_PUSHNIL
03 [12] OP_CREF 1 0
04 [10] OP_LREF 1
05 [10] OP_LREF 2
06 [17] OP_CALL 3
07 [18] OP_TAILCALL 4
== end
[20] OP_LAMBDA 0
[ 9] OP_GSET 166
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 5
# input expression
(define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env))))
ai = 5
before expand:
(define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env))))
[macroexpand] expanding... (define (rsc-macro-transformer f) (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env))))
[macroexpand] expanding... define
[macroexpand] expanding... ()
[macroexpand] expanding... (lambda (expr use-env mac-env) (make-syntactic-closure use-env (quote ()) (f expr mac-env)))
[macroexpand] expanding... lambda
[macroexpand] expanding... ()
[macroexpand] expanding... (make-syntactic-closure use-env (quote ()) (f expr mac-env))
[macroexpand] expanding... make-syntactic-closure
[macroexpand] expanding... use-env
[macroexpand] expanding... (quote ())
[macroexpand] expanding... quote
[macroexpand] expanding... (f expr mac-env)
[macroexpand] expanding... f
[macroexpand] expanding... expr
[macroexpand] expanding... mac-env
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... expr
[macroexpand] expanding... use-env
[macroexpand] expanding... mac-env
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... rsc-macro-transformer
[macroexpand] expanding... f
[macroexpand] expanding... ()
after expand:
(define (rsc-macro-transformer@173 f@172) (lambda (expr@174 use-env@175 mac-env@176) (make-syntactic-closure@156 use-env@175 (quote ()) (f@172 expr@174 mac-env@176))))
## macroexpand completed
(define (rsc-macro-transformer@173 f@172) (lambda (expr@174 use-env@175 mac-env@176) (make-syntactic-closure@156 use-env@175 (quote ()) (f@172 expr@174 mac-env@176))))
ai = 6
gc run!
## analyzer completed
(return (set! (ref 0 rsc-macro-transformer@173) (lambda (f@172) () #f (f@172) (return (lambda (expr@174 use-env@175 mac-env@176) () #f () (tail-call (ref 2 make-syntactic-closure@156) (ref 0 use-env@175) (quote ()) (call (ref 1 f@172) (ref 0 expr@174) (ref 0 mac-env@176))))))))
ai = 8
## resolver completed
(return (set! (gref 167) (lambda (f@172) () #f (f@172) (return (lambda (expr@174 use-env@175 mac-env@176) () #f () (tail-call (gref 155) (lref 2) (quote ()) (call (cref 1 0) (lref 1) (lref 3))))))))
ai = 9
## codegen completed
## irep 0x662c00
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 167
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x662c80
[clen = 2, argc = 2, localc = 0]
:: cv_num = 1
: 1 -> 0
00 [20] OP_LAMBDA 0
01 [19] OP_RET
## irep 0x662d00
[clen = 8, argc = 4, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 155
01 [10] OP_LREF 2
02 [ 2] OP_PUSHNIL
03 [12] OP_CREF 1 0
04 [10] OP_LREF 1
05 [10] OP_LREF 3
06 [17] OP_CALL 3
07 [18] OP_TAILCALL 4
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x662bc0>
argv = ()
irep = ## irep 0x662c00
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 167
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x662c80
[clen = 2, argc = 2, localc = 0]
:: cv_num = 1
: 1 -> 0
00 [20] OP_LAMBDA 0
01 [19] OP_RET
## irep 0x662d00
[clen = 8, argc = 4, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 155
01 [10] OP_LREF 2
02 [ 2] OP_PUSHNIL
03 [12] OP_CREF 1 0
04 [10] OP_LREF 1
05 [10] OP_LREF 3
06 [17] OP_CALL 3
07 [18] OP_TAILCALL 4
== end
[20] OP_LAMBDA 0
[ 9] OP_GSET 167
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 7
# input expression
(export sc-macro-transformer rsc-macro-transformer)
ai = 7
before expand:
(export sc-macro-transformer rsc-macro-transformer)
[macroexpand] expanding... (export sc-macro-transformer rsc-macro-transformer)
[macroexpand] expanding... export
after expand:
#f
## macroexpand completed
#f
ai = 7
## analyzer completed
(return (quote #f))
ai = 9
gc run!
## resolver completed
(return (quote #f))
ai = 10
## codegen completed
## irep 0x6888a0
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x688860>
argv = ()
irep = ## irep 0x6888a0
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
after expand:
#f
## macroexpand completed
#f
ai = 9
## analyzer completed
(return (quote #f))
ai = 11
## resolver completed
(return (quote #f))
ai = 12
## codegen completed
## irep 0x688160
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x688120>
argv = ()
irep = ## irep 0x688160
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 1
# input expression
(define-library (picrin bootstrap-tools) (import (scheme base)) (define (cadar p) (car (cdar p))) (define (caddr p) (car (cddr p))) (define (cdddr p) (cdr (cddr p))) (export cadar caddr cdddr))
ai = 1
before expand:
(define-library (picrin bootstrap-tools) (import (scheme base)) (define (cadar p) (car (cdar p))) (define (caddr p) (car (cddr p))) (define (cdddr p) (cdr (cddr p))) (export cadar caddr cdddr))
[macroexpand] expanding... (define-library (picrin bootstrap-tools) (import (scheme base)) (define (cadar p) (car (cdar p))) (define (caddr p) (car (cddr p))) (define (cdddr p) (cdr (cddr p))) (export cadar caddr cdddr))
[macroexpand] expanding... define-library
ai = 8
# input expression
(import (scheme base))
ai = 8
before expand:
(import (scheme base))
[macroexpand] expanding... (import (scheme base))
[macroexpand] expanding... import
* importing file-error? as file-error?@145
* importing char? as char?@134
* importing vector-set! as vector-set!@123
* importing procedure? as procedure?@112
* importing truncate-remainder as truncate-remainder@75
* importing negative? as negative?@62
* importing exact-integer? as exact-integer?@54
* importing peek-char as peek-char@43
* importing textual-port? as textual-port?@32
* importing append as append@21
* importing cddr as cddr@15
* importing eqv? as eqv?@2
* importing define
* importing string=? as string=?@151
* importing error as error@140
* importing call-with-current-continuation as call-with-current-continuation@129
* importing string->symbol as string->symbol@118
* importing round as round@81
* importing = as =@55
* importing real? as real?@49
* importing eof-object as eof-object@38
* importing current-input-port as current-input-port@27
* importing set-car! as set-car!@10
* importing lambda
* importing string? as string?@146
* importing char->integer as char->integer@135
* importing bytevector? as bytevector?@124
* importing apply as apply@113
* importing gcd as gcd@76
* importing odd? as odd?@63
* importing < as <@56
* importing newline as newline@44
* importing binary-port? as binary-port?@33
* importing reverse as reverse@22
* importing equal? as equal?@3
* importing if
* importing string<? as string<?@152
* importing error-object? as error-object?@141
* importing call/cc as call/cc@130
* importing vector? as vector?@119
* importing square as square@82
* importing abs as abs@71
* importing <= as <=@58
* importing rational? as rational?@50
* importing close-port as close-port@39
* importing current-output-port as current-output-port@28
* importing list? as list?@17
* importing set-cdr! as set-cdr!@11
* importing cons as cons@7
* importing begin
* importing make-string as make-string@147
* importing integer->char as integer->char@136
* importing make-bytevector as make-bytevector@125
* importing map as map@114
* importing lcm as lcm@77
* importing even? as even?@64
* importing > as >@57
* importing write-char as write-char@45
* importing port? as port?@34
* importing list-tail as list-tail@23
* importing car as car@8
* importing set!
* importing string>? as string>?@153
* importing error-object-message as error-object-message@142
* importing dynamic-wind as dynamic-wind@131
* importing make-vector as make-vector@120
* importing expt as expt@83
* importing floor-quotient as floor-quotient@72
* importing >= as >=@59
* importing integer? as integer?@51
* importing close-input-port as close-input-port@40
* importing current-error-port as current-error-port@29
* importing make-list as make-list@18
* importing caar as caar@12
* importing cdr as cdr@9
* importing boolean? as boolean?@5
* importing quote
* importing string-length as string-length@148
* importing with-exception-handler as with-exception-handler@137
* importing bytevector-length as bytevector-length@126
* importing for-each as for-each@115
* importing floor as floor@78
* importing min as min@65
* importing flush-output-port as flush-output-port@46
* importing input-port-open? as input-port-open?@35
* importing list-ref as list-ref@24
* importing null? as null?@16
* importing not as not@4
* importing string<=? as string<=?@154
* importing error-object-irritants as error-object-irritants@143
* importing values as values@132
* importing vector-length as vector-length@121
* importing inexact as inexact@84
* importing floor-remainder as floor-remainder@73
* importing + as +@67
* importing zero? as zero?@60
* importing exact? as exact?@52
* importing close-output-port as close-output-port@41
* importing input-port? as input-port?@30
* importing list as list@19
* importing cadr as cadr@13
* importing pair? as pair?@6
* importing string-ref as string-ref@149
* importing raise as raise@138
* importing bytevector-u8-ref as bytevector-u8-ref@127
* importing symbol? as symbol?@116
* importing ceiling as ceiling@79
* importing - as -@68
* importing max as max@66
* importing number? as number?@47
* importing output-port-open? as output-port-open?@36
* importing list-set! as list-set!@25
* importing string>=? as string>=?@155
* importing read-error? as read-error?@144
* importing call-with-values as call-with-values@133
* importing vector-ref as vector-ref@122
* importing exact as exact@85
* importing truncate-quotient as truncate-quotient@74
* importing * as *@69
* importing positive? as positive?@61
* importing inexact? as inexact?@53
* importing read-char as read-char@42
* importing output-port? as output-port?@31
* importing length as length@20
* importing cdar as cdar@14
* importing eq? as eq?@1
* importing define-syntax
* importing load as load@165
* importing string-set! as string-set!@150
* importing raise-continuable as raise-continuable@139
* importing bytevector-u8-set! as bytevector-u8-set!@128
* importing symbol->string as symbol->string@117
* importing truncate as truncate@80
* importing / as /@70
* importing complex? as complex?@48
* importing eof-object? as eof-object?@37
* importing list-copy as list-copy@26
* importing define-macro
after expand:
#f
## macroexpand completed
#f
ai = 8
## analyzer completed
(return (quote #f))
ai = 10
## resolver completed
(return (quote #f))
ai = 11
## codegen completed
## irep 0x688c40
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x688c00>
argv = ()
irep = ## irep 0x688c40
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 10
# input expression
(define (cadar p) (car (cdar p)))
ai = 10
before expand:
(define (cadar p) (car (cdar p)))
[macroexpand] expanding... (define (cadar p) (car (cdar p)))
[macroexpand] expanding... define
[macroexpand] expanding... ()
[macroexpand] expanding... (car (cdar p))
[macroexpand] expanding... car
[macroexpand] expanding... (cdar p)
[macroexpand] expanding... cdar
[macroexpand] expanding... p
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... cadar
[macroexpand] expanding... p
[macroexpand] expanding... ()
after expand:
(define (cadar@178 p@177) (car@8 (cdar@14 p@177)))
## macroexpand completed
(define (cadar@178 p@177) (car@8 (cdar@14 p@177)))
ai = 11
## analyzer completed
(return (set! (ref 0 cadar@178) (lambda (p@177) () #f () (return (car (call (ref 1 cdar@14) (ref 0 p@177)))))))
ai = 13
## resolver completed
(return (set! (gref 168) (lambda (p@177) () #f () (return (car (call (gref 13) (lref 1)))))))
ai = 14
## codegen completed
## irep 0x6634c0
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 168
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x663540
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 13
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [22] OP_CAR
04 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x663480>
argv = ()
irep = ## irep 0x6634c0
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 168
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x663540
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 13
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [22] OP_CAR
04 [19] OP_RET
== end
[20] OP_LAMBDA 0
[ 9] OP_GSET 168
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 12
# input expression
(define (caddr p) (car (cddr p)))
ai = 12
before expand:
(define (caddr p) (car (cddr p)))
[macroexpand] expanding... (define (caddr p) (car (cddr p)))
[macroexpand] expanding... define
[macroexpand] expanding... ()
[macroexpand] expanding... (car (cddr p))
[macroexpand] expanding... car
[macroexpand] expanding... (cddr p)
[macroexpand] expanding... cddr
[macroexpand] expanding... p
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... caddr
[macroexpand] expanding... p
[macroexpand] expanding... ()
after expand:
(define (caddr@180 p@179) (car@8 (cddr@15 p@179)))
## macroexpand completed
(define (caddr@180 p@179) (car@8 (cddr@15 p@179)))
ai = 13
gc run!
## analyzer completed
(return (set! (ref 0 caddr@180) (lambda (p@179) () #f () (return (car (call (ref 1 cddr@15) (ref 0 p@179)))))))
ai = 15
## resolver completed
(return (set! (gref 169) (lambda (p@179) () #f () (return (car (call (gref 14) (lref 1)))))))
ai = 16
## codegen completed
## irep 0x68aa70
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 169
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68aaf0
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 14
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [22] OP_CAR
04 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x68aa30>
argv = ()
irep = ## irep 0x68aa70
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 169
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68aaf0
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 14
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [22] OP_CAR
04 [19] OP_RET
== end
[20] OP_LAMBDA 0
[ 9] OP_GSET 169
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 14
# input expression
(define (cdddr p) (cdr (cddr p)))
ai = 14
before expand:
(define (cdddr p) (cdr (cddr p)))
[macroexpand] expanding... (define (cdddr p) (cdr (cddr p)))
[macroexpand] expanding... define
[macroexpand] expanding... ()
[macroexpand] expanding... (cdr (cddr p))
[macroexpand] expanding... cdr
[macroexpand] expanding... (cddr p)
[macroexpand] expanding... cddr
[macroexpand] expanding... p
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... cdddr
[macroexpand] expanding... p
[macroexpand] expanding... ()
after expand:
(define (cdddr@182 p@181) (cdr@9 (cddr@15 p@181)))
## macroexpand completed
(define (cdddr@182 p@181) (cdr@9 (cddr@15 p@181)))
ai = 15
gc run!
## analyzer completed
(return (set! (ref 0 cdddr@182) (lambda (p@181) () #f () (return (cdr (call (ref 1 cddr@15) (ref 0 p@181)))))))
ai = 17
## resolver completed
(return (set! (gref 170) (lambda (p@181) () #f () (return (cdr (call (gref 14) (lref 1)))))))
ai = 18
## codegen completed
## irep 0x68bdf0
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 170
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68be70
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 14
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [23] OP_CDR
04 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x68bdb0>
argv = ()
irep = ## irep 0x68bdf0
[clen = 4, argc = 1, localc = 0]
:: cv_num = 0
00 [20] OP_LAMBDA 0
01 [ 9] OP_GSET 170
02 [ 4] OP_PUSHFALSE
03 [19] OP_RET
## irep 0x68be70
[clen = 5, argc = 2, localc = 0]
:: cv_num = 0
00 [ 8] OP_GREF 14
01 [10] OP_LREF 1
02 [17] OP_CALL 2
03 [23] OP_CDR
04 [19] OP_RET
== end
[20] OP_LAMBDA 0
[ 9] OP_GSET 170
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 16
# input expression
(export cadar caddr cdddr)
ai = 16
before expand:
(export cadar caddr cdddr)
[macroexpand] expanding... (export cadar caddr cdddr)
[macroexpand] expanding... export
after expand:
#f
## macroexpand completed
#f
ai = 16
## analyzer completed
(return (quote #f))
ai = 18
## resolver completed
(return (quote #f))
ai = 19
## codegen completed
## irep 0x68b670
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x68b630>
argv = ()
irep = ## irep 0x68b670
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
after expand:
#f
## macroexpand completed
#f
ai = 18
## analyzer completed
(return (quote #f))
ai = 20
## resolver completed
(return (quote #f))
ai = 21
## codegen completed
## irep 0x68af30
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x68aef0>
argv = ()
irep = ## irep 0x68af30
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 1
# input expression
(define-library (picrin core-syntax) (import (scheme base) (picrin macro) (picrin bootstrap-tools)) (define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))) (define-syntax cond (er-macro-transformer (lambda (expr r compare) (let ((clauses (cdr expr))) (if (null? clauses) #f (if (compare (r (quote else)) (caar clauses)) (cons (r (quote begin)) (cdar clauses)) (list (r (quote if)) (caar clauses) (cons (r (quote begin)) (cdar clauses)) (cons (r (quote cond)) (cdr clauses))))))))) (define-syntax and (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #t (list (r (quote if)) (car exprs) (cons (r (quote and)) (cdr exprs)) #f)))))) (define-syntax or (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #f (list (r (quote let)) (list (list (r (quote it)) (car exprs))) (list (r (quote if)) (r (quote it)) (r (quote it)) (cons (r (quote or)) (cdr exprs))))))))) (define-syntax quasiquote (er-macro-transformer (lambda (expr r compare?) (let ((x (cadr expr))) (cond ((symbol? x) (list (r (quote quote)) x)) ((pair? x) (cond ((compare? (r (quote unquote)) (car x)) (cadr x)) ((and (pair? (car x)) (compare? (r (quote unquote-splicing)) (caar x))) (list (r (quote append)) (cadar x) (list (r (quote quasiquote)) (cdr x)))) (#t (list (r (quote cons)) (list (r (quote quasiquote)) (car x)) (list (r (quote quasiquote)) (cdr x)))))) (#t x)))))) (define-syntax let* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (if (null? bindings) (quasiquote ((unquote (r (quote let))) () (unquote-splicing body))) (quasiquote ((unquote (r (quote let))) (((unquote (caar bindings)) (unquote-splicing (cdar bindings)))) ((unquote (r (quote let*))) ((unquote-splicing (cdr bindings))) (unquote-splicing body))))))))) (define-syntax letrec* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (let ((vars (map (lambda (v) (quasiquote ((unquote v) #f))) (map car bindings))) (initials (map (lambda (v) (quasiquote ((unquote (r (quote set!))) (unquote-splicing v)))) bindings))) (quasiquote ((unquote (r (quote let))) ((unquote-splicing vars)) (unquote-splicing initials) (unquote-splicing body)))))))) (define-syntax letrec (er-macro-transformer (lambda (form rename compare) (quasiquote ((unquote (rename (quote letrec*))) (unquote-splicing (cdr form))))))) (define-syntax do (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (finish (caddr form)) (body (cdddr form))) (quasiquote ((unquote (r (quote let))) (unquote (r (quote loop))) (unquote (map (lambda (x) (list (car x) (cadr x))) bindings)) ((unquote (r (quote if))) (unquote (car finish)) ((unquote (r (quote begin))) (unquote-splicing (cdr finish))) ((unquote (r (quote begin))) (unquote-splicing body) ((unquote (r (quote loop))) (unquote-splicing (map (lambda (x) (if (null? (cddr x)) (car x) (car (cddr x)))) bindings))))))))))) (define-syntax when (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) ((unquote (rename (quote begin))) (unquote-splicing body)) #f)))))) (define-syntax unless (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) #f ((unquote (rename (quote begin))) (unquote-splicing body)))))))) (define-syntax case (er-macro-transformer (lambda (expr r compare) (let ((key (cadr expr)) (clauses (cddr expr))) (quasiquote ((unquote (r (quote let))) (((unquote (r (quote key))) (unquote key))) (unquote (let loop ((clauses clauses)) (if (null? clauses) #f (quasiquote ((unquote (r (quote if))) ((unquote (r (quote or))) (unquote-splicing (map (lambda (x) (quasiquote ((unquote (r (quote eqv?))) (unquote (r (quote key))) ((unquote (r (quote quote))) (unquote x))))) (caar clauses)))) (begin (unquote-splicing (cdar clauses))) (unquote (loop (cdr clauses)))))))))))))) (define-syntax syntax-error (er-macro-transformer (lambda (expr rename compare) (apply error (cdr expr))))) (define-syntax define-auxiliary-syntax (er-macro-transformer (lambda (expr r c) (quasiquote ((unquote (r (quote define-syntax))) (unquote (cadr expr)) ((unquote (r (quote sc-macro-transformer))) ((unquote (r (quote lambda))) (expr env) ((unquote (r (quote error))) "invalid use of auxiliary syntax")))))))) (define-auxiliary-syntax else) (define-auxiliary-syntax =>) (define-auxiliary-syntax _) (define-auxiliary-syntax ...) (define-auxiliary-syntax unquote) (define-auxiliary-syntax unquote-splicing) (export let let* letrec letrec* quasiquote unquote unquote-splicing and or cond case else => do when unless _ ... syntax-error))
ai = 1
before expand:
(define-library (picrin core-syntax) (import (scheme base) (picrin macro) (picrin bootstrap-tools)) (define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))) (define-syntax cond (er-macro-transformer (lambda (expr r compare) (let ((clauses (cdr expr))) (if (null? clauses) #f (if (compare (r (quote else)) (caar clauses)) (cons (r (quote begin)) (cdar clauses)) (list (r (quote if)) (caar clauses) (cons (r (quote begin)) (cdar clauses)) (cons (r (quote cond)) (cdr clauses))))))))) (define-syntax and (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #t (list (r (quote if)) (car exprs) (cons (r (quote and)) (cdr exprs)) #f)))))) (define-syntax or (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #f (list (r (quote let)) (list (list (r (quote it)) (car exprs))) (list (r (quote if)) (r (quote it)) (r (quote it)) (cons (r (quote or)) (cdr exprs))))))))) (define-syntax quasiquote (er-macro-transformer (lambda (expr r compare?) (let ((x (cadr expr))) (cond ((symbol? x) (list (r (quote quote)) x)) ((pair? x) (cond ((compare? (r (quote unquote)) (car x)) (cadr x)) ((and (pair? (car x)) (compare? (r (quote unquote-splicing)) (caar x))) (list (r (quote append)) (cadar x) (list (r (quote quasiquote)) (cdr x)))) (#t (list (r (quote cons)) (list (r (quote quasiquote)) (car x)) (list (r (quote quasiquote)) (cdr x)))))) (#t x)))))) (define-syntax let* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (if (null? bindings) (quasiquote ((unquote (r (quote let))) () (unquote-splicing body))) (quasiquote ((unquote (r (quote let))) (((unquote (caar bindings)) (unquote-splicing (cdar bindings)))) ((unquote (r (quote let*))) ((unquote-splicing (cdr bindings))) (unquote-splicing body))))))))) (define-syntax letrec* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (let ((vars (map (lambda (v) (quasiquote ((unquote v) #f))) (map car bindings))) (initials (map (lambda (v) (quasiquote ((unquote (r (quote set!))) (unquote-splicing v)))) bindings))) (quasiquote ((unquote (r (quote let))) ((unquote-splicing vars)) (unquote-splicing initials) (unquote-splicing body)))))))) (define-syntax letrec (er-macro-transformer (lambda (form rename compare) (quasiquote ((unquote (rename (quote letrec*))) (unquote-splicing (cdr form))))))) (define-syntax do (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (finish (caddr form)) (body (cdddr form))) (quasiquote ((unquote (r (quote let))) (unquote (r (quote loop))) (unquote (map (lambda (x) (list (car x) (cadr x))) bindings)) ((unquote (r (quote if))) (unquote (car finish)) ((unquote (r (quote begin))) (unquote-splicing (cdr finish))) ((unquote (r (quote begin))) (unquote-splicing body) ((unquote (r (quote loop))) (unquote-splicing (map (lambda (x) (if (null? (cddr x)) (car x) (car (cddr x)))) bindings))))))))))) (define-syntax when (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) ((unquote (rename (quote begin))) (unquote-splicing body)) #f)))))) (define-syntax unless (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) #f ((unquote (rename (quote begin))) (unquote-splicing body)))))))) (define-syntax case (er-macro-transformer (lambda (expr r compare) (let ((key (cadr expr)) (clauses (cddr expr))) (quasiquote ((unquote (r (quote let))) (((unquote (r (quote key))) (unquote key))) (unquote (let loop ((clauses clauses)) (if (null? clauses) #f (quasiquote ((unquote (r (quote if))) ((unquote (r (quote or))) (unquote-splicing (map (lambda (x) (quasiquote ((unquote (r (quote eqv?))) (unquote (r (quote key))) ((unquote (r (quote quote))) (unquote x))))) (caar clauses)))) (begin (unquote-splicing (cdar clauses))) (unquote (loop (cdr clauses)))))))))))))) (define-syntax syntax-error (er-macro-transformer (lambda (expr rename compare) (apply error (cdr expr))))) (define-syntax define-auxiliary-syntax (er-macro-transformer (lambda (expr r c) (quasiquote ((unquote (r (quote define-syntax))) (unquote (cadr expr)) ((unquote (r (quote sc-macro-transformer))) ((unquote (r (quote lambda))) (expr env) ((unquote (r (quote error))) "invalid use of auxiliary syntax")))))))) (define-auxiliary-syntax else) (define-auxiliary-syntax =>) (define-auxiliary-syntax _) (define-auxiliary-syntax ...) (define-auxiliary-syntax unquote) (define-auxiliary-syntax unquote-splicing) (export let let* letrec letrec* quasiquote unquote unquote-splicing and or cond case else => do when unless _ ... syntax-error))
[macroexpand] expanding... (define-library (picrin core-syntax) (import (scheme base) (picrin macro) (picrin bootstrap-tools)) (define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))) (define-syntax cond (er-macro-transformer (lambda (expr r compare) (let ((clauses (cdr expr))) (if (null? clauses) #f (if (compare (r (quote else)) (caar clauses)) (cons (r (quote begin)) (cdar clauses)) (list (r (quote if)) (caar clauses) (cons (r (quote begin)) (cdar clauses)) (cons (r (quote cond)) (cdr clauses))))))))) (define-syntax and (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #t (list (r (quote if)) (car exprs) (cons (r (quote and)) (cdr exprs)) #f)))))) (define-syntax or (er-macro-transformer (lambda (expr r compare) (let ((exprs (cdr expr))) (if (null? exprs) #f (list (r (quote let)) (list (list (r (quote it)) (car exprs))) (list (r (quote if)) (r (quote it)) (r (quote it)) (cons (r (quote or)) (cdr exprs))))))))) (define-syntax quasiquote (er-macro-transformer (lambda (expr r compare?) (let ((x (cadr expr))) (cond ((symbol? x) (list (r (quote quote)) x)) ((pair? x) (cond ((compare? (r (quote unquote)) (car x)) (cadr x)) ((and (pair? (car x)) (compare? (r (quote unquote-splicing)) (caar x))) (list (r (quote append)) (cadar x) (list (r (quote quasiquote)) (cdr x)))) (#t (list (r (quote cons)) (list (r (quote quasiquote)) (car x)) (list (r (quote quasiquote)) (cdr x)))))) (#t x)))))) (define-syntax let* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (if (null? bindings) (quasiquote ((unquote (r (quote let))) () (unquote-splicing body))) (quasiquote ((unquote (r (quote let))) (((unquote (caar bindings)) (unquote-splicing (cdar bindings)))) ((unquote (r (quote let*))) ((unquote-splicing (cdr bindings))) (unquote-splicing body))))))))) (define-syntax letrec* (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (body (cddr form))) (let ((vars (map (lambda (v) (quasiquote ((unquote v) #f))) (map car bindings))) (initials (map (lambda (v) (quasiquote ((unquote (r (quote set!))) (unquote-splicing v)))) bindings))) (quasiquote ((unquote (r (quote let))) ((unquote-splicing vars)) (unquote-splicing initials) (unquote-splicing body)))))))) (define-syntax letrec (er-macro-transformer (lambda (form rename compare) (quasiquote ((unquote (rename (quote letrec*))) (unquote-splicing (cdr form))))))) (define-syntax do (er-macro-transformer (lambda (form r compare) (let ((bindings (cadr form)) (finish (caddr form)) (body (cdddr form))) (quasiquote ((unquote (r (quote let))) (unquote (r (quote loop))) (unquote (map (lambda (x) (list (car x) (cadr x))) bindings)) ((unquote (r (quote if))) (unquote (car finish)) ((unquote (r (quote begin))) (unquote-splicing (cdr finish))) ((unquote (r (quote begin))) (unquote-splicing body) ((unquote (r (quote loop))) (unquote-splicing (map (lambda (x) (if (null? (cddr x)) (car x) (car (cddr x)))) bindings))))))))))) (define-syntax when (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) ((unquote (rename (quote begin))) (unquote-splicing body)) #f)))))) (define-syntax unless (er-macro-transformer (lambda (expr rename compare) (let ((test (cadr expr)) (body (cddr expr))) (quasiquote ((unquote (rename (quote if))) (unquote test) #f ((unquote (rename (quote begin))) (unquote-splicing body)))))))) (define-syntax case (er-macro-transformer (lambda (expr r compare) (let ((key (cadr expr)) (clauses (cddr expr))) (quasiquote ((unquote (r (quote let))) (((unquote (r (quote key))) (unquote key))) (unquote (let loop ((clauses clauses)) (if (null? clauses) #f (quasiquote ((unquote (r (quote if))) ((unquote (r (quote or))) (unquote-splicing (map (lambda (x) (quasiquote ((unquote (r (quote eqv?))) (unquote (r (quote key))) ((unquote (r (quote quote))) (unquote x))))) (caar clauses)))) (begin (unquote-splicing (cdar clauses))) (unquote (loop (cdr clauses)))))))))))))) (define-syntax syntax-error (er-macro-transformer (lambda (expr rename compare) (apply error (cdr expr))))) (define-syntax define-auxiliary-syntax (er-macro-transformer (lambda (expr r c) (quasiquote ((unquote (r (quote define-syntax))) (unquote (cadr expr)) ((unquote (r (quote sc-macro-transformer))) ((unquote (r (quote lambda))) (expr env) ((unquote (r (quote error))) "invalid use of auxiliary syntax")))))))) (define-auxiliary-syntax else) (define-auxiliary-syntax =>) (define-auxiliary-syntax _) (define-auxiliary-syntax ...) (define-auxiliary-syntax unquote) (define-auxiliary-syntax unquote-splicing) (export let let* letrec letrec* quasiquote unquote unquote-splicing and or cond case else => do when unless _ ... syntax-error))
[macroexpand] expanding... define-library
ai = 8
# input expression
(import (scheme base) (picrin macro) (picrin bootstrap-tools))
ai = 8
before expand:
(import (scheme base) (picrin macro) (picrin bootstrap-tools))
[macroexpand] expanding... (import (scheme base) (picrin macro) (picrin bootstrap-tools))
[macroexpand] expanding... import
* importing file-error? as file-error?@145
* importing char? as char?@134
* importing vector-set! as vector-set!@123
* importing procedure? as procedure?@112
* importing truncate-remainder as truncate-remainder@75
* importing negative? as negative?@62
* importing exact-integer? as exact-integer?@54
* importing peek-char as peek-char@43
* importing textual-port? as textual-port?@32
* importing append as append@21
* importing cddr as cddr@15
* importing eqv? as eqv?@2
* importing define
* importing string=? as string=?@151
* importing error as error@140
* importing call-with-current-continuation as call-with-current-continuation@129
* importing string->symbol as string->symbol@118
* importing round as round@81
* importing = as =@55
* importing real? as real?@49
* importing eof-object as eof-object@38
* importing current-input-port as current-input-port@27
* importing set-car! as set-car!@10
* importing lambda
* importing string? as string?@146
* importing char->integer as char->integer@135
* importing bytevector? as bytevector?@124
* importing apply as apply@113
* importing gcd as gcd@76
* importing odd? as odd?@63
* importing < as <@56
* importing newline as newline@44
* importing binary-port? as binary-port?@33
* importing reverse as reverse@22
* importing equal? as equal?@3
* importing if
* importing string<? as string<?@152
* importing error-object? as error-object?@141
* importing call/cc as call/cc@130
* importing vector? as vector?@119
* importing square as square@82
* importing abs as abs@71
* importing <= as <=@58
* importing rational? as rational?@50
* importing close-port as close-port@39
* importing current-output-port as current-output-port@28
* importing list? as list?@17
* importing set-cdr! as set-cdr!@11
* importing cons as cons@7
* importing begin
* importing make-string as make-string@147
* importing integer->char as integer->char@136
* importing make-bytevector as make-bytevector@125
* importing map as map@114
* importing lcm as lcm@77
* importing even? as even?@64
* importing > as >@57
* importing write-char as write-char@45
* importing port? as port?@34
* importing list-tail as list-tail@23
* importing car as car@8
* importing set!
* importing string>? as string>?@153
* importing error-object-message as error-object-message@142
* importing dynamic-wind as dynamic-wind@131
* importing make-vector as make-vector@120
* importing expt as expt@83
* importing floor-quotient as floor-quotient@72
* importing >= as >=@59
* importing integer? as integer?@51
* importing close-input-port as close-input-port@40
* importing current-error-port as current-error-port@29
* importing make-list as make-list@18
* importing caar as caar@12
* importing cdr as cdr@9
* importing boolean? as boolean?@5
* importing quote
* importing string-length as string-length@148
* importing with-exception-handler as with-exception-handler@137
* importing bytevector-length as bytevector-length@126
* importing for-each as for-each@115
* importing floor as floor@78
* importing min as min@65
* importing flush-output-port as flush-output-port@46
* importing input-port-open? as input-port-open?@35
* importing list-ref as list-ref@24
* importing null? as null?@16
* importing not as not@4
* importing string<=? as string<=?@154
* importing error-object-irritants as error-object-irritants@143
* importing values as values@132
* importing vector-length as vector-length@121
* importing inexact as inexact@84
* importing floor-remainder as floor-remainder@73
* importing + as +@67
* importing zero? as zero?@60
* importing exact? as exact?@52
* importing close-output-port as close-output-port@41
* importing input-port? as input-port?@30
* importing list as list@19
* importing cadr as cadr@13
* importing pair? as pair?@6
* importing string-ref as string-ref@149
* importing raise as raise@138
* importing bytevector-u8-ref as bytevector-u8-ref@127
* importing symbol? as symbol?@116
* importing ceiling as ceiling@79
* importing - as -@68
* importing max as max@66
* importing number? as number?@47
* importing output-port-open? as output-port-open?@36
* importing list-set! as list-set!@25
* importing string>=? as string>=?@155
* importing read-error? as read-error?@144
* importing call-with-values as call-with-values@133
* importing vector-ref as vector-ref@122
* importing exact as exact@85
* importing truncate-quotient as truncate-quotient@74
* importing * as *@69
* importing positive? as positive?@61
* importing inexact? as inexact?@53
* importing read-char as read-char@42
* importing output-port? as output-port?@31
* importing length as length@20
* importing cdar as cdar@14
* importing eq? as eq?@1
* importing define-syntax
* importing load as load@165
* importing string-set! as string-set!@150
* importing raise-continuable as raise-continuable@139
* importing bytevector-u8-set! as bytevector-u8-set!@128
* importing symbol->string as symbol->string@117
* importing truncate as truncate@80
* importing / as /@70
* importing complex? as complex?@48
* importing eof-object? as eof-object?@37
* importing list-copy as list-copy@26
* importing define-macro
* importing make-syntactic-closure as make-syntactic-closure@156
* importing sc-macro-transformer as sc-macro-transformer@168
* importing identifier? as identifier?@157
* importing identifier=? as identifier=?@158
* importing er-macro-transformer as er-macro-transformer@159
* importing rsc-macro-transformer as rsc-macro-transformer@173
* importing ir-macro-transformer as ir-macro-transformer@160
* importing cadar as cadar@178
* importing caddr as caddr@180
* importing cdddr as cdddr@182
after expand:
#f
## macroexpand completed
#f
ai = 8
## analyzer completed
(return (quote #f))
ai = 10
## resolver completed
(return (quote #f))
ai = 11
## codegen completed
## irep 0x662c00
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
# compilation finished
### booting VM... ###
[17] OP_CALL 1
== calling proc...
proc = #<proc 0x662bc0>
argv = ()
irep = ## irep 0x662c00
[clen = 2, argc = 1, localc = 0]
:: cv_num = 0
00 [ 4] OP_PUSHFALSE
01 [19] OP_RET
== end
[ 4] OP_PUSHFALSE
[19] OP_RET
[33] OP_STOP
**VM END STATE**
stbase = 0x6034e0
sp = 0x6034e0
cibase = 0x6074f0
ci = 0x6074f0
ai = 10
# input expression
(define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings)))))))
ai = 10
before expand:
(define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings)))))))
[macroexpand] expanding... (define-syntax let (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings)))))))
[macroexpand] expanding... define-syntax
ai = 10
# input expression
(er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))
ai = 10
before expand:
(er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))
[macroexpand] expanding... (er-macro-transformer (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))))
[macroexpand] expanding... er-macro-transformer
[macroexpand] expanding... (lambda (expr r compare) (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings)))))
[macroexpand] expanding... lambda
[macroexpand] expanding... ()
[macroexpand] expanding... (if (symbol? (cadr expr)) (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))) (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))))
[macroexpand] expanding... if
[macroexpand] expanding... (symbol? (cadr expr))
[macroexpand] expanding... symbol?
[macroexpand] expanding... (cadr expr)
[macroexpand] expanding... cadr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (begin (define name (cadr expr)) (define bindings (caddr expr)) (define body (cdddr expr)) (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings))))
[macroexpand] expanding... begin
[macroexpand] expanding... (define name (cadr expr))
[macroexpand] expanding... define
[macroexpand] expanding... name
[macroexpand] expanding... (cadr expr)
[macroexpand] expanding... cadr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (define bindings (caddr expr))
[macroexpand] expanding... define
[macroexpand] expanding... bindings
[macroexpand] expanding... (caddr expr)
[macroexpand] expanding... caddr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (define body (cdddr expr))
[macroexpand] expanding... define
[macroexpand] expanding... body
[macroexpand] expanding... (cdddr expr)
[macroexpand] expanding... cdddr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (list (r (quote let)) (quote ()) (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body))) (cons name (map cadr bindings)))
[macroexpand] expanding... list
[macroexpand] expanding... (r (quote let))
[macroexpand] expanding... r
[macroexpand] expanding... (quote let)
[macroexpand] expanding... quote
[macroexpand] expanding... ()
[macroexpand] expanding... (quote ())
[macroexpand] expanding... quote
[macroexpand] expanding... (list (r (quote define)) name (cons (r (quote lambda)) (cons (map car bindings) body)))
[macroexpand] expanding... list
[macroexpand] expanding... (r (quote define))
[macroexpand] expanding... r
[macroexpand] expanding... (quote define)
[macroexpand] expanding... quote
gc run!
[macroexpand] expanding... ()
[macroexpand] expanding... name
[macroexpand] expanding... (cons (r (quote lambda)) (cons (map car bindings) body))
[macroexpand] expanding... cons
[macroexpand] expanding... (r (quote lambda))
[macroexpand] expanding... r
[macroexpand] expanding... (quote lambda)
[macroexpand] expanding... quote
[macroexpand] expanding... ()
[macroexpand] expanding... (cons (map car bindings) body)
[macroexpand] expanding... cons
[macroexpand] expanding... (map car bindings)
[macroexpand] expanding... map
[macroexpand] expanding... car
[macroexpand] expanding... bindings
[macroexpand] expanding... ()
[macroexpand] expanding... body
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (cons name (map cadr bindings))
[macroexpand] expanding... cons
[macroexpand] expanding... name
[macroexpand] expanding... (map cadr bindings)
[macroexpand] expanding... map
[macroexpand] expanding... cadr
[macroexpand] expanding... bindings
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (begin (set! bindings (cadr expr)) (set! body (cddr expr)) (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings)))
[macroexpand] expanding... begin
[macroexpand] expanding... (set! bindings (cadr expr))
[macroexpand] expanding... set!
[macroexpand] expanding... bindings
[macroexpand] expanding... (cadr expr)
[macroexpand] expanding... cadr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (set! body (cddr expr))
[macroexpand] expanding... set!
[macroexpand] expanding... body
[macroexpand] expanding... (cddr expr)
[macroexpand] expanding... cddr
[macroexpand] expanding... expr
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (cons (cons (r (quote lambda)) (cons (map car bindings) body)) (map cadr bindings))
[macroexpand] expanding... cons
[macroexpand] expanding... (cons (r (quote lambda)) (cons (map car bindings) body))
[macroexpand] expanding... cons
[macroexpand] expanding... (r (quote lambda))
[macroexpand] expanding... r
[macroexpand] expanding... (quote lambda)
[macroexpand] expanding... quote
[macroexpand] expanding... ()
[macroexpand] expanding... (cons (map car bindings) body)
[macroexpand] expanding... cons
[macroexpand] expanding... (map car bindings)
[macroexpand] expanding... map
[macroexpand] expanding... car
[macroexpand] expanding... bindings
[macroexpand] expanding... ()
[macroexpand] expanding... body
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... (map cadr bindings)
[macroexpand] expanding... map
[macroexpand] expanding... cadr
[macroexpand] expanding... bindings
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... ()
[macroexpand] expanding... expr
[macroexpand] expanding... r
[macroexpand] expanding... compare
[macroexpand] expanding... ()
[macroexpand] expanding... ()
after expand:
(er-macro-transformer@159 (lambda (expr@183 r@184 compare@185) (if (symbol?@116 (cadr@13 expr@183)) (begin (define name@186 (cadr@13 expr@183)) (define bindings@187 (caddr@180 expr@183)) (define body@188 (cdddr@182 expr@183)) (list@19 (r@184 (quote let)) (quote ()) (list@19 (r@184 (quote define)) name@186 (cons@7 (r@184 (quote lambda)) (cons@7 (map@114 car@8 bindings@187) body@188))) (cons@7 name@186 (map@114 cadr@13 bindings@187)))) (begin (set! bindings@187 (cadr@13 expr@183)) (set! body@188 (cddr@15 expr@183)) (cons@7 (cons@7 (r@184 (quote lambda)) (cons@7 (map@114 car@8 bindings@187) body@188)) (map@114 cadr@13 bindings@187))))))
## macroexpand completed
(er-macro-transformer@159 (lambda (expr@183 r@184 compare@185) (if (symbol?@116 (cadr@13 expr@183)) (begin (define name@186 (cadr@13 expr@183)) (define bindings@187 (caddr@180 expr@183)) (define body@188 (cdddr@182 expr@183)) (list@19 (r@184 (quote let)) (quote ()) (list@19 (r@184 (quote define)) name@186 (cons@7 (r@184 (quote lambda)) (cons@7 (map@114 car@8 bindings@187) body@188))) (cons@7 name@186 (map@114 cadr@13 bindings@187)))) (begin (set! bindings@187 (cadr@13 expr@183)) (set! body@188 (cddr@15 expr@183)) (cons@7 (cons@7 (r@184 (quote lambda)) (cons@7 (map@114 car@8 bindings@187) body@188)) (map@114 cadr@13 bindings@187))))))
ai = 11
macroexpand error: symbol: unbound variable
Makefile:40: recipe for target 'run' failed
make: *** [run] 中止 (コアダンプしました)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment