Skip to content

Commit

Permalink
push/pop is not working at all
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Jan 3, 2024
1 parent c9f2172 commit d9608f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
17 changes: 13 additions & 4 deletions stdlib/helpers.lm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@
\t syscall \n
);

::newline := (
\t mov $1, %rax \n
\t mov $1, %rdi \n
\t mov $__newline, %rsi \n
\t mov $1, %rdx \n
\t syscall \n
);

::yield-nil := (
# $_.$0 ref_counter is unnecessary when open
# open structures are completely "owned" by the current context
Expand All @@ -105,19 +113,16 @@

::yield-cons := λhead tail. (
head # this is head
::show-this
::push-this

tail # this is tail
::push-this

::pop-this
::show-this
::close-this
::show-close
mov %rbx, %rsp \n # %rsp is tail

::pop-this
::show-this
::close-this # %rbx is head
::show-close

Expand All @@ -143,6 +148,8 @@

\t mov %r15, %r8 \n
::put64

::newline
);

::show-close := (
Expand All @@ -163,6 +170,8 @@

\t mov 24(%rbx), %r8 \n
::put64

::newline
);

::call := λf. (
Expand Down
3 changes: 3 additions & 0 deletions stdlib/prelude.lm
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@
__put64_write_buffer: \n
\t .ascii "0000000000000000 " \n
\t .zero 1 \n
__newline: \n
\t .ascii "\n" \n
\t .zero 1 \n
);
2 changes: 1 addition & 1 deletion tests/cons.lm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

main := (
print-s (() 123)
print-s (123 456)
# print-s (123 () 456)
);

0 comments on commit d9608f6

Please sign in to comment.