blob: 2aab75c5cd8fc7881946b4a05da75c1b58e855f0 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
;;; flic-structs.scm -- structures to define FLIC intermediate language
;;;
;;; author : Sandra Loosemore
;;; date : 24 Mar 1992
(define-struct flic-exp
(type-template flic-td)
(slots
(unboxed? (type bool) (default '#f) (bit #t))
(cheap? (type bool) (default '#f) (bit #t))))
;;; Use a macro to define each subtype and a BOA constructor.
;;; Maybe eventually the constructors will need to do additional
;;; initialization and have to be defined by hand.
(define-local-syntax (define-flic name . slots)
(let* ((maker (symbol-append 'make- name))
(pred (symbol-append name '?))
(args (map (function car) slots))
(inits (map (lambda (x) (list x x)) args)))
`(begin
(define-struct ,name
(include flic-exp)
(predicate ,pred)
(slots ,@slots))
(define (,maker ,@args) (make ,name ,@inits))
',name)))
(define-flic flic-lambda
(vars (type (list var)))
(body (type flic-exp)))
(define-flic flic-let
;; value exp is stored in var-value slot
(bindings (type (list var)))
(body (type flic-exp))
(recursive? (type bool) (bit #t)))
(define-flic flic-app
(fn (type flic-exp))
(args (type (list flic-exp)))
;; true if number of args exactly matches arity of fn
(saturated? (type bool) (bit #t)))
(define-flic flic-ref
(var (type var)))
(define-flic flic-const
(value (type t)))
(define-flic flic-pack
(con (type con)))
(define-flic flic-case-block
(block-name (type symbol))
(exps (type (list flic-exp))))
(define-flic flic-return-from
(block-name (type symbol))
(exp (type flic-exp)))
(define-flic flic-and
(exps (type (list flic-exp))))
(define-flic flic-if
(test-exp (type flic-exp))
(then-exp (type flic-exp))
(else-exp (type flic-exp)))
(define-flic flic-sel
(con (type con))
(i (type int))
(exp (type flic-exp)))
(define-flic flic-is-constructor
(con (type con))
(exp (type flic-exp)))
(define-flic flic-con-number
(type (type algdata))
(exp (type flic-exp)))
(define-flic flic-void
)
|