-
Notifications
You must be signed in to change notification settings - Fork 1
/
structs.scm
170 lines (148 loc) · 6.66 KB
/
structs.scm
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
;; ---------------------------------------------------------------------- ;;
;; FICHIER : structs.scm ;;
;; DATE DE CREATION : Mon May 29 09:57:03 1995 ;;
;; DERNIERE MODIFICATION : Mon May 29 09:57:29 1995 ;;
;; ---------------------------------------------------------------------- ;;
;; Copyright (c) 1995 Dominique Boucher ;;
;; ---------------------------------------------------------------------- ;;
;; Structures declarations ... ;;
;; ---------------------------------------------------------------------- ;;
;; ---------------------------------------------------------------------- ;;
;; Interface de l'AST ;;
;; ---------------------------------------------------------------------- ;;
;; --- Les déclarations ... --------------------------------------------- ;;
(def-struct defining-form type)
(def-struct local-decl declaration)
(def-struct expr expr)
(def-struct def-class flags name super guts)
(def-struct def-constant names value)
(def-struct def-generic flags name params return-type prop-list)
(def-struct def-method flags name params return-type body)
(def-struct def-variable names value)
(def-struct ast-let names value)
(def-struct let-handler type prop-list expr)
(def-struct local-method list)
(def-struct variable name type)
(def-struct named-method name params return-type body)
(def-struct keyword name)
;; --- Les expressions ... ---------------------------------------------- ;;
;; ------- to be modified
(def-struct binop-series list)
;; -------
(def-struct binary-op name)
(def-struct unary-op operator operand)
(def-struct ast-symbol name)
(def-struct array-ref seq element)
(def-struct funcall function arguments)
(def-struct anonym-method descr)
(def-struct slot-reference object slot)
(def-struct assignment place new-value)
(def-struct or-expr form1 form2)
(def-struct and-expr form1 form2)
(def-struct statement statement)
(def-struct true-constant )
(def-struct false-constant )
(def-struct concat-string list)
(def-struct character value)
(def-struct ast-integer value)
(def-struct float value)
(def-struct literal-symbol name)
(def-struct dotted-list before after)
(def-struct literal-list elements)
(def-struct literal-vector elements)
;; --- Les énoncés ... -------------------------------------------------- ;;
(def-struct begin-form body)
(def-struct block-exit symbol body epilog)
(def-struct block-epilog cleanup excepts)
(def-struct ast-case cond-body)
(def-struct ast-if test then-part else-part)
(def-struct ast-for header body final-part)
(def-struct for-header type test)
(def-struct for-explicit multi? vars init-val next-val)
(def-struct for-collection var key coll)
(def-struct for-numeric var start bound step)
(def-struct select target-form test cases)
(def-struct until test body)
(def-struct while test body)
(def-struct exception name type prop-list body)
(def-struct cond-clause matches body)
(def-struct other-clause body)
;; --- Les classes ... -------------------------------------------------- ;;
(def-struct slot-spec flags alloc name type prop-list)
(def-struct keyword-spec required? name prop-list)
(def-struct inherited-spec name prop-list)
;; --- Les fonctions génériques ... ------------------------------------- ;;
(def-struct return-type head rest)
(def-struct position-param name type singleton)
(def-struct next-param name)
(def-struct rest-param name)
(def-struct all-keys )
(def-struct gf-keyword keyword symbol type)
(def-struct keyword-param keyword variable type default)
;; ---------------------------------------------------------------------- ;;
;; Les déclarations de modules ... ;;
;; ---------------------------------------------------------------------- ;;
(def-struct module-defn name clauses)
(def-struct export-clause names)
(def-struct create-clause names)
(def-struct use-clause name options)
(def-struct prefix-opt string)
(def-struct import-opt imports)
(def-struct exclude-opt nameset)
(def-struct export-opt nameset)
(def-struct rename-opt specs)
;; ---------------------------------------------------------------------- ;;
;; La représentation d'un module. ;;
;; ---------------------------------------------------------------------- ;;
(def-struct module
name
exports ; les variables exportées
creates ; les variables créées
rename-alist ; les variables renommées
env)
;; ---------------------------------------------------------------------- ;;
;; La représentation des classes et instances ... ;;
;; ---------------------------------------------------------------------- ;;
(def-struct class
name ; nom de la classe (symbole Scheme)
instantiated? ; La classe a-t-elle été instantiée?
sealed? abstract? primary? ; qualificatifs de la classe
supers ; super-classes
direct-subs ; sous-classes directes
prec-list ; liste de précédence
slots ; ==> liste d'association (nom . slot-struct)
class-slots ; ==> slots de la classe (allocation = class)
init-args ; ==> liste d'association (cle . ...)
)
(def-struct slot
class-def ; classe où la slot a été déclarée
getter-name ; nom du `getter'
setter-name ; nom du `setter'
type deferred-type ; type et type différé
init-value init-function ; valeur et fonction initiales
init-key req-init-key
allocation) ; qualificatif d'allocation
(def-struct init-arg
required?
type
init-value
init-function)
(def-struct singleton
object)
(def-struct instance
class slots)
;; ---------------------------------------------------------------------- ;;
;; Les méthodes et fonctions génériques ... ;;
;; ---------------------------------------------------------------------- ;;
(def-struct generic
name nreq spec rest? keys all-keys? values methods code)
(def-struct method
name fs nreq spec rest? keys all-keys? values next-name env code)
(def-struct return-value
req rest? type)
;; ---------------------------------------------------------------------- ;;
;; Les environnements ... ;;
;; ---------------------------------------------------------------------- ;;
(def-struct binding
name value type constant?)
;; --- Fin du fichier `structs.scm' ------------------------------------- ;;