From 4b7d499c3dbd5586aa855e54367d95930fd42a81 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 31 Jan 2023 14:07:03 +0100 Subject: Minor improvements; implement saturated function and constructor applications --- driver.s | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'driver.s') diff --git a/driver.s b/driver.s index 44520b2..d717270 100644 --- a/driver.s +++ b/driver.s @@ -1,11 +1,21 @@ .data + .align 2 +heap: + .space 0x80000 # 512KiB + .align 1 _cINT: .byte 0 # pointer arity .byte 1 # basic value arity .byte 0 # number of arguments that still have to be curried in + .align 1 +_cCHAR: + .byte 0 # pointer arity + .byte 1 # basic value arity + .byte 0 # number of arguments that still have to be curried in + .align 2 PRINTROOT: .word _nroot @@ -14,9 +24,6 @@ EVALROOT: .word _nroot .word 0 # to be filled in - .align 2 -heap: - .text main: la $gp,heap @@ -56,6 +63,8 @@ print_hnf: lw $t0,($s1) la $t1,_cINT beq $t0,$t1,print_int + la $t1,_cCHAR + beq $t0,$t1,print_char li $a0,'(' li $v0,11 # print_char syscall @@ -76,6 +85,19 @@ print_int: b print_rewind nop +print_char: + li $a0,39 # ' + li $v0,11 # print_char + syscall + lw $a0,4($s1) + li $v0,11 # print_char + syscall + li $a0,39 # ' + li $v0,11 # print_char + syscall + b print_rewind + nop + print_rewind: la $t5,PRINTROOT beq $s0,$t5,print_rewind_root -- cgit v1.2.3