mirror of
https://github.com/kanaka/mal.git
synced 2024-09-21 10:37:58 +03:00
step 8 macros
* Added macroexpand functions and special symbol * Some changes to how AST is freed by apply_fn, to avoid having to shuffle the stack after a call. 7 failing tests. "rest" can return vector or list, but should always return a list. Other errors in -> and ->> macros seem more difficult to solve.
This commit is contained in:
parent
6df6dfd358
commit
d00896dcad
@ -1357,7 +1357,7 @@ core_rest:
|
||||
je .missing_args
|
||||
|
||||
cmp al, content_nil
|
||||
je .return_nil
|
||||
je .empty_list
|
||||
|
||||
cmp al, content_pointer
|
||||
jne .not_list
|
||||
|
@ -10,6 +10,7 @@ section .data
|
||||
static unknown_type_string, db "#<unknown>"
|
||||
static unknown_value_string, db "#<unknown value>"
|
||||
static function_type_string, db "#<function>"
|
||||
static macro_type_string, db "#<macro>"
|
||||
static nil_value_string, db "nil"
|
||||
static true_value_string, db "true"
|
||||
static false_value_string, db "false"
|
||||
@ -138,7 +139,7 @@ pr_str:
|
||||
je .vector
|
||||
|
||||
cmp ch, container_function
|
||||
je .function
|
||||
je .function_or_macro
|
||||
|
||||
cmp ch, container_atom
|
||||
je .atom
|
||||
@ -502,12 +503,22 @@ pr_str:
|
||||
ret
|
||||
|
||||
; --------------------------------
|
||||
.function:
|
||||
.function_or_macro:
|
||||
cmp cl, maltype_macro
|
||||
je .macro
|
||||
|
||||
; a function
|
||||
mov rsi, function_type_string
|
||||
mov edx, function_type_string.len
|
||||
call raw_to_string ; Puts a String in RAX
|
||||
ret
|
||||
|
||||
.macro:
|
||||
mov rsi, macro_type_string
|
||||
mov edx, macro_type_string.len
|
||||
call raw_to_string ; Puts a String in RAX
|
||||
ret
|
||||
|
||||
; --------------------------------
|
||||
.atom:
|
||||
mov rsi, [rsi + Cons.car] ; What the atom points to
|
||||
|
2453
nasm/step8_macros.asm
Normal file
2453
nasm/step8_macros.asm
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user