This commit is contained in:
2026-05-18 08:41:37 -06:00
parent 4ef6788029
commit afc68e2a55
32 changed files with 270 additions and 38 deletions

Binary file not shown.

BIN
play/string Executable file

Binary file not shown.

4
play/string.anf Normal file
View File

@@ -0,0 +1,4 @@
;;; -*- mode:scheme -*-
(let ((x0 (prim:write "abc"))) x0)

23
play/string.s Normal file
View File

@@ -0,0 +1,23 @@
.data
.balign 8
.1:
.ascii "abc"
/* end data */
.text
.globl main
main:
pushq %rbp
movq %rsp, %rbp
movl $3, %esi
leaq .1(%rip), %rdi
callq scm_from_utf8_string
movq %rax, %rdi
callq scm_write
leave
ret
.type main, @function
.size main, .-main
/* end function main */
.section .note.GNU-stack,"",@progbits

1
play/string.scm Normal file
View File

@@ -0,0 +1 @@
(prim:write "abc")

10
play/string.ssa Normal file
View File

@@ -0,0 +1,10 @@
data $.1 =
{b "abc"}
export
function w $main () {
@start
%.2 =l call $scm_from_utf8_string (l $.1, l 3)
%x0 =l call $scm_write (l %.2)
ret %x0
}

BIN
play/t

Binary file not shown.

View File

@@ -1,4 +1,4 @@
;;; -*- mode:scheme -*-
(let ((x0 (prim:cons 4 2)) (x1 (prim:cdr x0)) (x2 (prim:* 3 x1)) (x3 (prim:write x2))) x3)
(let ((x0 (prim:cons 4 2)) (x1 (prim:write x0))) x1)

View File

@@ -5,9 +5,9 @@ main:
movq %rsp, %rbp
movl $16, %edi
callq GC_malloc
movq $18, (%rax)
movq $10, 8(%rax)
movl $26, %edi
movq %rax, %rdi
movq $18, (%rdi)
movq $10, 8(%rdi)
callq scm_write
leave
ret

View File

@@ -1,2 +1 @@
(prim:write (prim:* 3
(prim:cdr (prim:cons 4 2))))
(prim:write (prim:cons 4 2))

View File

@@ -2,16 +2,9 @@ export
function w $main () {
@start
%x0 =l call $GC_malloc (l 16)
%.4 =l add %x0, 8
%.2 =l add %x0, 8
storel 18, %x0
storel 10, %.4
%.5 =l add %x0, 8
%x1 =l loadl %.5
%.6 =l shr 14, 2
%.7 =l shr %x1, 2
%.8 =l mul %.6, %.7
%.9 =l shl %.8, 2
%x2 =l add %.9, 2
%x3 =l call $scm_write (l %x2)
ret %x3
storel 10, %.2
%x1 =l call $scm_write (l %x0)
ret %x1
}

31
play/wtf.s Normal file
View File

@@ -0,0 +1,31 @@
.data
.balign 8
fstr:
.ascii "%s"
.byte 0
/* end data */
.data
.balign 8
str:
.ascii "안녕하세요"
.byte 0
/* end data */
.text
.globl main
main:
pushq %rbp
movq %rsp, %rbp
leaq str(%rip), %rsi
leaq fstr(%rip), %rdi
movl $0, %eax
callq printf
movl $0, %eax
leave
ret
.type main, @function
.size main, .-main
/* end function main */
.section .note.GNU-stack,"",@progbits

8
play/wtf.ssa Normal file
View File

@@ -0,0 +1,8 @@
data $fstr = { b "%s", b 0 }
data $str = { b "안녕하세요", b 0 }
export function w $main () {
@start
call $printf (l $fstr, ..., l $str)
ret 0
}