diff options
Diffstat (limited to 'src/compiler.h')
-rw-r--r-- | src/compiler.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler.h b/src/compiler.h index 76d6ccf..18e8a3e 100644 --- a/src/compiler.h +++ b/src/compiler.h | |||
@@ -139,6 +139,12 @@ compile_type_predicate(OpType op, Object* args) { | |||
139 | printf(" ;; <-- compile_type_predicate\n"); | 139 | printf(" ;; <-- compile_type_predicate\n"); |
140 | } | 140 | } |
141 | 141 | ||
142 | |||
143 | // TODO: Next -> numerical comparison operators =, <=, ... | ||
144 | // "=", "<", ">", "<=", ">=", | ||
145 | // "not", "and", "or", | ||
146 | // NOTE: Make sure to stop evaluating if the condition is not met. | ||
147 | |||
142 | void | 148 | void |
143 | compile_arithmetic_list(OpType op, Object* args) { | 149 | compile_arithmetic_list(OpType op, Object* args) { |
144 | printf(" ;; --> compile_arithmetic_list\n"); | 150 | printf(" ;; --> compile_arithmetic_list\n"); |
@@ -183,6 +189,11 @@ compile_proc_call(Object *obj) { | |||
183 | if (sv_equal(&obj->head->text, &STRING("bool?"))) { | 189 | if (sv_equal(&obj->head->text, &STRING("bool?"))) { |
184 | compile_type_predicate(OP_IS_BOOL, obj->tail); | 190 | compile_type_predicate(OP_IS_BOOL, obj->tail); |
185 | } | 191 | } |
192 | if (sv_equal(&obj->head->text, &STRING("display"))) { | ||
193 | compile_object(obj->tail->head); | ||
194 | printf(" pop rdi\n"); | ||
195 | printf(" call display\n"); | ||
196 | } | ||
186 | } | 197 | } |
187 | 198 | ||
188 | void | 199 | void |
@@ -199,6 +210,14 @@ compile_object(Object *obj) { | |||
199 | 210 | ||
200 | void | 211 | void |
201 | compile(Root *roots) { | 212 | compile(Root *roots) { |
213 | printf("%%define NIL_VAL %d\n", NIL_VAL); | ||
214 | printf("%%define BOOL_MASK %d\n", BOOL_MASK); | ||
215 | printf("%%define BOOL_TAG %d\n", BOOL_TAG); | ||
216 | printf("%%define BOOL_SHIFT %d\n", BOOL_SHIFT); | ||
217 | printf("%%define FIXNUM_MASK %d\n", FIXNUM_MASK); | ||
218 | printf("%%define FIXNUM_TAG %d\n", FIXNUM_TAG); | ||
219 | printf("%%define FIXNUM_SHIFT %d\n", FIXNUM_SHIFT); | ||
220 | printf("\n"); | ||
202 | emit_file(PRELUDE_FILE); | 221 | emit_file(PRELUDE_FILE); |
203 | for (size_t i = 0; i < array_size(roots); i++) { | 222 | for (size_t i = 0; i < array_size(roots); i++) { |
204 | Object *root = roots[i]; | 223 | Object *root = roots[i]; |