Closure conversion, reify-primitives use $kfun $cont
[bpt/guile.git] / module / language / cps.scm
CommitLineData
80b01fd0
AW
1;;; Continuation-passing style (CPS) intermediate language (IL)
2
7ab76a83 3;; Copyright (C) 2013, 2014 Free Software Foundation, Inc.
80b01fd0
AW
4
5;;;; This library is free software; you can redistribute it and/or
6;;;; modify it under the terms of the GNU Lesser General Public
7;;;; License as published by the Free Software Foundation; either
8;;;; version 3 of the License, or (at your option) any later version.
9;;;;
10;;;; This library is distributed in the hope that it will be useful,
11;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13;;;; Lesser General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU Lesser General Public
16;;;; License along with this library; if not, write to the Free Software
17;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19;;; Commentary:
20;;;
21;;; This is the continuation-passing style (CPS) intermediate language
22;;; (IL) for Guile.
23;;;
24;;; There are two kinds of terms in CPS: terms that bind continuations,
25;;; and terms that call continuations.
26;;;
27;;; $letk binds a set of mutually recursive continuations, each one an
6e422a35
AW
28;;; instance of $cont. A $cont declares the name of a continuation, and
29;;; then contains as a subterm the particular continuation instance:
30;;; $kif for test continuations, $kargs for continuations that bind
31;;; values, etc.
80b01fd0
AW
32;;;
33;;; $continue nodes call continuations. The expression contained in the
34;;; $continue node determines the value or values that are passed to the
35;;; target continuation: $const to pass a constant value, $values to
6e422a35 36;;; pass multiple named values, etc. $continue nodes also record the source at which
80b01fd0
AW
37;;;
38;;; Additionally there is $letrec, a term that binds mutually recursive
39;;; functions. The contification pass will turn $letrec into $letk if
40;;; it can do so. Otherwise, the closure conversion pass will desugar
41;;; $letrec into an equivalent sequence of make-closure primcalls and
42;;; subsequent initializations of the captured variables of the
43;;; closures. You can think of $letrec as pertaining to "high CPS",
44;;; whereas later passes will only see "low CPS", which does not have
45;;; $letrec.
46;;;
47;;; This particular formulation of CPS was inspired by Andrew Kennedy's
48;;; 2007 paper, "Compiling with Continuations, Continued". All Guile
49;;; hackers should read that excellent paper! As in Kennedy's paper,
50;;; continuations are second-class, and may be thought of as basic block
51;;; labels. All values are bound to variables using continuation calls:
52;;; even constants!
53;;;
54;;; There are some Guile-specific quirks as well:
55;;;
36527695 56;;; - $kreceive represents a continuation that receives multiple values,
80b01fd0
AW
57;;; but which truncates them to some number of required values,
58;;; possibly with a rest list.
59;;;
8320f504 60;;; - $kfun labels an entry point for a $fun (a function), and
80b01fd0
AW
61;;; contains a $ktail representing the formal argument which is the
62;;; function's continuation.
63;;;
8320f504 64;;; - $kfun also contain a $kclause continuation, corresponding to
90dce16d
AW
65;;; the first case-lambda clause of the function. $kclause actually
66;;; contains the clause body, and the subsequent clause (if any).
67;;; This is because the $kclause logically matches or doesn't match
68;;; a given set of actual arguments against a formal arity, then
69;;; proceeds to a "body" continuation (which is a $kargs).
80b01fd0
AW
70;;;
71;;; That's to say that a $fun can be matched like this:
72;;;
73;;; (match f
24b611e8 74;;; (($ $fun free
8320f504
AW
75;;; ($ $cont kfun
76;;; ($ $kfun src meta self ($ $cont ktail ($ $ktail))
90dce16d 77;;; ($ $kclause arity
24b611e8 78;;; ($ $cont kbody ($ $kargs names syms body))
90dce16d 79;;; alternate))))
80b01fd0
AW
80;;; #t))
81;;;
8320f504 82;;; A $continue to ktail is in tail position. $kfun, $kclause,
80b01fd0
AW
83;;; and $ktail will never be seen elsewhere in a CPS term.
84;;;
85;;; - $prompt continues to the body of the prompt, having pushed on a
86;;; prompt whose handler will continue at its "handler"
87;;; continuation. The continuation of the prompt is responsible for
7ab76a83 88;;; popping the prompt.
80b01fd0
AW
89;;;
90;;; In summary:
91;;;
92;;; - $letk, $letrec, and $continue are terms.
93;;;
94;;; - $cont is a continuation, containing a continuation body ($kargs,
95;;; $kif, etc).
96;;;
97;;; - $continue terms contain an expression ($call, $const, $fun,
98;;; etc).
99;;;
100;;; See (language tree-il compile-cps) for details on how Tree-IL
101;;; converts to CPS.
102;;;
103;;; Code:
104
105(define-module (language cps)
106 #:use-module (ice-9 match)
107 #:use-module ((srfi srfi-1) #:select (fold))
108 #:use-module (srfi srfi-9)
109 #:use-module (srfi srfi-9 gnu)
828ed944 110 #:use-module (srfi srfi-11)
80b01fd0
AW
111 #:export (;; Helper.
112 $arity
113 make-$arity
114
115 ;; Terms.
116 $letk $continue $letrec
117
118 ;; Continuations.
119 $cont
120
121 ;; Continuation bodies.
8320f504 122 $kif $kreceive $kargs $kfun $ktail $kclause
80b01fd0
AW
123
124 ;; Expressions.
b3ae2b50 125 $void $const $prim $fun $call $callk $primcall $values $prompt
80b01fd0 126
9a1dfb7d
AW
127 ;; Fresh names.
128 label-counter var-counter
129 fresh-label fresh-var
828ed944
AW
130 with-fresh-name-state compute-max-label-and-var
131 let-fresh
9a1dfb7d 132
80b01fd0 133 ;; Building macros.
80b01fd0
AW
134 build-cps-term build-cps-cont build-cps-exp
135 rewrite-cps-term rewrite-cps-cont rewrite-cps-exp
136
137 ;; Misc.
138 parse-cps unparse-cps
2c3c086e
AW
139 make-cont-folder fold-conts fold-local-conts
140 visit-cont-successors))
80b01fd0
AW
141
142;; FIXME: Use SRFI-99, when Guile adds it.
143(define-syntax define-record-type*
144 (lambda (x)
145 (define (id-append ctx . syms)
146 (datum->syntax ctx (apply symbol-append (map syntax->datum syms))))
147 (syntax-case x ()
148 ((_ name field ...)
149 (and (identifier? #'name) (and-map identifier? #'(field ...)))
150 (with-syntax ((cons (id-append #'name #'make- #'name))
151 (pred (id-append #'name #'name #'?))
152 ((getter ...) (map (lambda (f)
153 (id-append f #'name #'- f))
154 #'(field ...))))
155 #'(define-record-type name
156 (cons field ...)
157 pred
158 (field getter)
159 ...))))))
160
161(define-syntax-rule (define-cps-type name field ...)
162 (begin
163 (define-record-type* name field ...)
164 (set-record-type-printer! name print-cps)))
165
166(define (print-cps exp port)
167 (format port "#<cps ~S>" (unparse-cps exp)))
168
169;; Helper.
170(define-record-type* $arity req opt rest kw allow-other-keys?)
171
172;; Terms.
173(define-cps-type $letk conts body)
6e422a35 174(define-cps-type $continue k src exp)
80b01fd0
AW
175(define-cps-type $letrec names syms funs body)
176
177;; Continuations
6e422a35 178(define-cps-type $cont k cont)
80b01fd0 179(define-cps-type $kif kt kf)
36527695 180(define-cps-type $kreceive arity k)
80b01fd0 181(define-cps-type $kargs names syms body)
8320f504 182(define-cps-type $kfun src meta self tail clause)
80b01fd0 183(define-cps-type $ktail)
90dce16d 184(define-cps-type $kclause arity cont alternate)
80b01fd0
AW
185
186;; Expressions.
80b01fd0
AW
187(define-cps-type $void)
188(define-cps-type $const val)
189(define-cps-type $prim name)
24b611e8 190(define-cps-type $fun free body)
80b01fd0 191(define-cps-type $call proc args)
b3ae2b50 192(define-cps-type $callk k proc args)
80b01fd0
AW
193(define-cps-type $primcall name args)
194(define-cps-type $values args)
7ab76a83 195(define-cps-type $prompt escape? tag handler)
80b01fd0 196
9a1dfb7d
AW
197(define label-counter (make-parameter #f))
198(define var-counter (make-parameter #f))
199
200(define (fresh-label)
828ed944
AW
201 (let ((count (or (label-counter)
202 (error "fresh-label outside with-fresh-name-state"))))
9a1dfb7d
AW
203 (label-counter (1+ count))
204 count))
205
9a1dfb7d 206(define (fresh-var)
1eda52c8 207 (let ((count (or (var-counter)
828ed944 208 (error "fresh-var outside with-fresh-name-state"))))
1eda52c8 209 (var-counter (1+ count))
9a1dfb7d
AW
210 count))
211
212(define-syntax-rule (let-fresh (label ...) (var ...) body ...)
213 (let ((label (fresh-label)) ...
214 (var (fresh-var)) ...)
215 body ...))
216
828ed944 217(define-syntax-rule (with-fresh-name-state fun body ...)
d3dbf75a 218 (call-with-values (lambda () (compute-max-label-and-var fun))
3e1b97c1
AW
219 (lambda (max-label max-var)
220 (parameterize ((label-counter (1+ max-label))
221 (var-counter (1+ max-var)))
222 body ...))))
80b01fd0
AW
223
224(define-syntax build-arity
225 (syntax-rules (unquote)
226 ((_ (unquote exp)) exp)
227 ((_ (req opt rest kw allow-other-keys?))
228 (make-$arity req opt rest kw allow-other-keys?))))
229
230(define-syntax build-cont-body
8320f504 231 (syntax-rules (unquote $kif $kreceive $kargs $kfun $ktail $kclause)
80b01fd0
AW
232 ((_ (unquote exp))
233 exp)
234 ((_ ($kif kt kf))
235 (make-$kif kt kf))
36527695
AW
236 ((_ ($kreceive req rest kargs))
237 (make-$kreceive (make-$arity req '() rest '() #f) kargs))
f5fcd7f2
AW
238 ((_ ($kargs (name ...) (unquote syms) body))
239 (make-$kargs (list name ...) syms (build-cps-term body)))
80b01fd0
AW
240 ((_ ($kargs (name ...) (sym ...) body))
241 (make-$kargs (list name ...) (list sym ...) (build-cps-term body)))
242 ((_ ($kargs names syms body))
243 (make-$kargs names syms (build-cps-term body)))
8320f504
AW
244 ((_ ($kfun src meta self tail clause))
245 (make-$kfun src meta self (build-cps-cont tail) (build-cps-cont clause)))
80b01fd0
AW
246 ((_ ($ktail))
247 (make-$ktail))
90dce16d
AW
248 ((_ ($kclause arity cont alternate))
249 (make-$kclause (build-arity arity) (build-cps-cont cont)
250 (build-cps-cont alternate)))))
80b01fd0
AW
251
252(define-syntax build-cps-cont
253 (syntax-rules (unquote)
254 ((_ (unquote exp)) exp)
6e422a35 255 ((_ (k cont)) (make-$cont k (build-cont-body cont)))))
80b01fd0
AW
256
257(define-syntax build-cps-exp
258 (syntax-rules (unquote
b3ae2b50 259 $void $const $prim $fun $call $callk $primcall $values $prompt)
80b01fd0 260 ((_ (unquote exp)) exp)
80b01fd0
AW
261 ((_ ($void)) (make-$void))
262 ((_ ($const val)) (make-$const val))
263 ((_ ($prim name)) (make-$prim name))
24b611e8
AW
264 ((_ ($fun free body))
265 (make-$fun free (build-cps-cont body)))
f5fcd7f2 266 ((_ ($call proc (unquote args))) (make-$call proc args))
80b01fd0
AW
267 ((_ ($call proc (arg ...))) (make-$call proc (list arg ...)))
268 ((_ ($call proc args)) (make-$call proc args))
f5fcd7f2 269 ((_ ($callk k proc (unquote args))) (make-$callk k proc args))
b3ae2b50
AW
270 ((_ ($callk k proc (arg ...))) (make-$callk k proc (list arg ...)))
271 ((_ ($callk k proc args)) (make-$callk k proc args))
f5fcd7f2 272 ((_ ($primcall name (unquote args))) (make-$primcall name args))
80b01fd0
AW
273 ((_ ($primcall name (arg ...))) (make-$primcall name (list arg ...)))
274 ((_ ($primcall name args)) (make-$primcall name args))
f5fcd7f2 275 ((_ ($values (unquote args))) (make-$values args))
80b01fd0
AW
276 ((_ ($values (arg ...))) (make-$values (list arg ...)))
277 ((_ ($values args)) (make-$values args))
7ab76a83
AW
278 ((_ ($prompt escape? tag handler))
279 (make-$prompt escape? tag handler))))
80b01fd0
AW
280
281(define-syntax build-cps-term
282 (syntax-rules (unquote $letk $letk* $letconst $letrec $continue)
283 ((_ (unquote exp))
284 exp)
285 ((_ ($letk (unquote conts) body))
286 (make-$letk conts (build-cps-term body)))
287 ((_ ($letk (cont ...) body))
288 (make-$letk (list (build-cps-cont cont) ...)
289 (build-cps-term body)))
290 ((_ ($letk* () body))
291 (build-cps-term body))
292 ((_ ($letk* (cont conts ...) body))
293 (build-cps-term ($letk (cont) ($letk* (conts ...) body))))
294 ((_ ($letconst () body))
295 (build-cps-term body))
296 ((_ ($letconst ((name sym val) tail ...) body))
9a1dfb7d 297 (let-fresh (kconst) ()
80b01fd0 298 (build-cps-term
6e422a35
AW
299 ($letk ((kconst ($kargs (name) (sym) ($letconst (tail ...) body))))
300 ($continue kconst (let ((props (source-properties val)))
301 (and (pair? props) props))
302 ($const val))))))
80b01fd0
AW
303 ((_ ($letrec names gensyms funs body))
304 (make-$letrec names gensyms funs (build-cps-term body)))
6e422a35
AW
305 ((_ ($continue k src exp))
306 (make-$continue k src (build-cps-exp exp)))))
80b01fd0
AW
307
308(define-syntax-rule (rewrite-cps-term x (pat body) ...)
309 (match x
310 (pat (build-cps-term body)) ...))
311(define-syntax-rule (rewrite-cps-cont x (pat body) ...)
312 (match x
313 (pat (build-cps-cont body)) ...))
314(define-syntax-rule (rewrite-cps-exp x (pat body) ...)
315 (match x
316 (pat (build-cps-exp body)) ...))
317
318(define (parse-cps exp)
319 (define (src exp)
320 (let ((props (source-properties exp)))
321 (and (pair? props) props)))
322 (match exp
323 ;; Continuations.
324 (('letconst k (name sym c) body)
325 (build-cps-term
6e422a35
AW
326 ($letk ((k ($kargs (name) (sym)
327 ,(parse-cps body))))
328 ($continue k (src exp) ($const c)))))
80b01fd0
AW
329 (('let k (name sym val) body)
330 (build-cps-term
6e422a35
AW
331 ($letk ((k ($kargs (name) (sym)
332 ,(parse-cps body))))
80b01fd0
AW
333 ,(parse-cps val))))
334 (('letk (cont ...) body)
335 (build-cps-term
336 ($letk ,(map parse-cps cont) ,(parse-cps body))))
337 (('k sym body)
338 (build-cps-cont
6e422a35 339 (sym ,(parse-cps body))))
80b01fd0
AW
340 (('kif kt kf)
341 (build-cont-body ($kif kt kf)))
36527695
AW
342 (('kreceive req rest k)
343 (build-cont-body ($kreceive req rest k)))
80b01fd0
AW
344 (('kargs names syms body)
345 (build-cont-body ($kargs names syms ,(parse-cps body))))
8320f504 346 (('kfun src meta self tail clause)
80b01fd0 347 (build-cont-body
8320f504 348 ($kfun (src exp) meta self ,(parse-cps tail)
24b611e8 349 ,(and=> clause parse-cps))))
80b01fd0
AW
350 (('ktail)
351 (build-cont-body
352 ($ktail)))
353 (('kclause (req opt rest kw allow-other-keys?) body)
354 (build-cont-body
355 ($kclause (req opt rest kw allow-other-keys?)
90dce16d
AW
356 ,(parse-cps body)
357 ,#f)))
358 (('kclause (req opt rest kw allow-other-keys?) body alternate)
359 (build-cont-body
360 ($kclause (req opt rest kw allow-other-keys?)
361 ,(parse-cps body)
362 ,(parse-cps alternate))))
80b01fd0
AW
363 (('kseq body)
364 (build-cont-body ($kargs () () ,(parse-cps body))))
365
366 ;; Calls.
367 (('continue k exp)
6e422a35 368 (build-cps-term ($continue k (src exp) ,(parse-cps exp))))
80b01fd0
AW
369 (('void)
370 (build-cps-exp ($void)))
371 (('const exp)
372 (build-cps-exp ($const exp)))
373 (('prim name)
374 (build-cps-exp ($prim name)))
24b611e8
AW
375 (('fun free body)
376 (build-cps-exp ($fun free ,(parse-cps body))))
80b01fd0
AW
377 (('letrec ((name sym fun) ...) body)
378 (build-cps-term
379 ($letrec name sym (map parse-cps fun) ,(parse-cps body))))
380 (('call proc arg ...)
381 (build-cps-exp ($call proc arg)))
b3ae2b50
AW
382 (('callk k proc arg ...)
383 (build-cps-exp ($callk k proc arg)))
80b01fd0
AW
384 (('primcall name arg ...)
385 (build-cps-exp ($primcall name arg)))
386 (('values arg ...)
387 (build-cps-exp ($values arg)))
7ab76a83
AW
388 (('prompt escape? tag handler)
389 (build-cps-exp ($prompt escape? tag handler)))
80b01fd0
AW
390 (_
391 (error "unexpected cps" exp))))
392
393(define (unparse-cps exp)
394 (match exp
395 ;; Continuations.
6e422a35
AW
396 (($ $letk (($ $cont k ($ $kargs (name) (sym) body)))
397 ($ $continue k src ($ $const c)))
80b01fd0
AW
398 `(letconst ,k (,name ,sym ,c)
399 ,(unparse-cps body)))
6e422a35 400 (($ $letk (($ $cont k ($ $kargs (name) (sym) body))) val)
80b01fd0
AW
401 `(let ,k (,name ,sym ,(unparse-cps val))
402 ,(unparse-cps body)))
403 (($ $letk conts body)
404 `(letk ,(map unparse-cps conts) ,(unparse-cps body)))
6e422a35 405 (($ $cont sym body)
80b01fd0
AW
406 `(k ,sym ,(unparse-cps body)))
407 (($ $kif kt kf)
408 `(kif ,kt ,kf))
36527695
AW
409 (($ $kreceive ($ $arity req () rest '() #f) k)
410 `(kreceive ,req ,rest ,k))
80b01fd0
AW
411 (($ $kargs () () body)
412 `(kseq ,(unparse-cps body)))
413 (($ $kargs names syms body)
414 `(kargs ,names ,syms ,(unparse-cps body)))
8320f504
AW
415 (($ $kfun src meta self tail clause)
416 `(kfun ,meta ,self ,(unparse-cps tail) ,(unparse-cps clause)))
80b01fd0
AW
417 (($ $ktail)
418 `(ktail))
90dce16d
AW
419 (($ $kclause ($ $arity req opt rest kw allow-other-keys?) body alternate)
420 `(kclause (,req ,opt ,rest ,kw ,allow-other-keys?) ,(unparse-cps body)
421 . ,(if alternate (list (unparse-cps alternate)) '())))
80b01fd0
AW
422
423 ;; Calls.
6e422a35 424 (($ $continue k src exp)
80b01fd0 425 `(continue ,k ,(unparse-cps exp)))
80b01fd0
AW
426 (($ $void)
427 `(void))
428 (($ $const val)
429 `(const ,val))
430 (($ $prim name)
431 `(prim ,name))
24b611e8
AW
432 (($ $fun free body)
433 `(fun ,free ,(unparse-cps body)))
80b01fd0
AW
434 (($ $letrec names syms funs body)
435 `(letrec ,(map (lambda (name sym fun)
436 (list name sym (unparse-cps fun)))
437 names syms funs)
438 ,(unparse-cps body)))
439 (($ $call proc args)
440 `(call ,proc ,@args))
b3ae2b50
AW
441 (($ $callk k proc args)
442 `(callk ,k ,proc ,@args))
80b01fd0
AW
443 (($ $primcall name args)
444 `(primcall ,name ,@args))
445 (($ $values args)
446 `(values ,@args))
7ab76a83
AW
447 (($ $prompt escape? tag handler)
448 `(prompt ,escape? ,tag ,handler))
80b01fd0
AW
449 (_
450 (error "unexpected cps" exp))))
451
a6f823bd 452(define-syntax-rule (make-cont-folder global? seed ...)
686a6490 453 (lambda (proc cont seed ...)
828ed944
AW
454 (define (fold-values proc in seed ...)
455 (if (null? in)
456 (values seed ...)
457 (let-values (((seed ...) (proc (car in) seed ...)))
458 (fold-values proc (cdr in) seed ...))))
459
460 (define (cont-folder cont seed ...)
461 (match cont
462 (($ $cont k cont)
463 (let-values (((seed ...) (proc k cont seed ...)))
464 (match cont
465 (($ $kargs names syms body)
466 (term-folder body seed ...))
467
8320f504 468 (($ $kfun src meta self tail clause)
828ed944 469 (let-values (((seed ...) (cont-folder tail seed ...)))
90dce16d
AW
470 (if clause
471 (cont-folder clause seed ...)
472 (values seed ...))))
473
474 (($ $kclause arity body alternate)
475 (let-values (((seed ...) (cont-folder body seed ...)))
476 (if alternate
477 (cont-folder alternate seed ...)
478 (values seed ...))))
828ed944
AW
479
480 (_ (values seed ...)))))))
481
482 (define (fun-folder fun seed ...)
483 (match fun
24b611e8 484 (($ $fun free body)
828ed944
AW
485 (cont-folder body seed ...))))
486
487 (define (term-folder term seed ...)
488 (match term
489 (($ $letk conts body)
490 (let-values (((seed ...) (term-folder body seed ...)))
491 (fold-values cont-folder conts seed ...)))
492
493 (($ $continue k src exp)
494 (match exp
a6f823bd
AW
495 (($ $fun)
496 (if global?
497 (fun-folder exp seed ...)
498 (values seed ...)))
828ed944
AW
499 (_ (values seed ...))))
500
501 (($ $letrec names syms funs body)
502 (let-values (((seed ...) (term-folder body seed ...)))
a6f823bd
AW
503 (if global?
504 (fold-values fun-folder funs seed ...)
505 (values seed ...))))))
828ed944 506
686a6490 507 (cont-folder cont seed ...)))
828ed944
AW
508
509(define (compute-max-label-and-var fun)
a6f823bd 510 ((make-cont-folder #t max-label max-var)
828ed944
AW
511 (lambda (label cont max-label max-var)
512 (values (max label max-label)
513 (match cont
408da790
AW
514 (($ $kargs names vars body)
515 (let lp ((body body) (max-var (fold max max-var vars)))
516 (match body
517 (($ $letk conts body) (lp body max-var))
518 (($ $letrec names vars funs body)
519 (lp body (fold max max-var vars)))
520 (_ max-var))))
8320f504 521 (($ $kfun src meta self)
1eda52c8 522 (max self max-var))
828ed944
AW
523 (_ max-var))))
524 fun
525 -1
526 -1))
80b01fd0 527
828ed944 528(define (fold-conts proc seed fun)
a6f823bd 529 ((make-cont-folder #t seed) proc fun seed))
80b01fd0 530
a6f823bd
AW
531(define (fold-local-conts proc seed fun)
532 ((make-cont-folder #f seed) proc fun seed))
2c3c086e
AW
533
534(define (visit-cont-successors proc cont)
535 (match cont
536 (($ $kargs names syms body)
537 (let lp ((body body))
538 (match body
539 (($ $letk conts body) (lp body))
540 (($ $letrec names vars funs body) (lp body))
541 (($ $continue k src exp)
542 (match exp
543 (($ $prompt escape? tag handler) (proc k handler))
544 (_ (proc k)))))))
545
546 (($ $kif kt kf) (proc kt kf))
547
548 (($ $kreceive arity k) (proc k))
549
550 (($ $kclause arity ($ $cont kbody) #f) (proc kbody))
551
552 (($ $kclause arity ($ $cont kbody) ($ $cont kalt)) (proc kbody kalt))
553
8320f504 554 (($ $kfun src meta self tail ($ $cont clause)) (proc clause))
2c3c086e 555
8320f504 556 (($ $kfun src meta self tail #f) (proc))
2c3c086e
AW
557
558 (($ $ktail) (proc))))