Update readme and tests

This commit is contained in:
zongor 2025-09-21 11:07:44 -07:00
parent cf767b2401
commit 6a8a334903
5 changed files with 20 additions and 12 deletions

View File

@ -41,15 +41,15 @@ It is:
**VM Architecture** **VM Architecture**
| Feature | Specification | | Feature | Specification |
|--------------------+-----------------------------------------------| |--------------------+----------------------------------------------------|
| Instruction Format | 1-byte opcode, 3-variable operand (CISC-like) | | Instruction Format | 1-byte opcode, variable length operand (CISC-like) |
| Register Set | 32 general-purpose registers (R0-R31) | | Register Set | 32 general-purpose registers (R0-R31) |
| Initialization | **ZII**: Zero Is Initialization | | Initialization | **ZII**: Zero Is Initialization |
| Memory Model | Frame-based arenas (function scope = frame) | | Memory Model | Frame-based arenas (function scope = frame) |
| Heap Behavior | Copy-on-write; allocations append to frame | | Heap Behavior | Copy-on-write; allocations append to frame |
| Frame Exit | Pointer resets on return (stack-GC style) | | Frame Exit | Pointer resets on return (stack-GC style) |
| Error Handling | Returns stub pointers to zeroed memory | | Error Handling | Returns stub pointers to zeroed memory |
This ensures: This ensures:
- No =malloc=, no =free=, no GC - No =malloc=, no =free=, no GC

View File

@ -1,4 +1,4 @@
(lambda add-two (a b) (lambda add-two (a b)
(return (add a b))) (return (+ a b)))
(print (to-string (add-two 1 1))) (print (to-string (add-two 1 1)))

View File

@ -1 +1 @@
(print (add 1.0 2.0)) (print (+ 1.0 2.0))

View File

@ -3,8 +3,12 @@
(load $0 &terminal-str) (load $0 &terminal-str)
(load $1 &hello-str) (load $1 &hello-str)
(strlen $2 $1) (strlen $2 $1)
(syscall DEVICE_WRITE $0 $1 $2) (syscall DEVICE_WRITE $0 $1 $2)
(load $3 &new-line)
(string-length $4 $3)
(syscall DEVICE-WRITE, $0, $3, $4)
(halt))) (halt)))
(data (data
(label terminal-str "/dev/term/0") (label terminal-str "/dev/term/0")
(label new-line "\n")
(label hello-str "nuqneH 'u'?"))) (label hello-str "nuqneH 'u'?")))

View File

@ -7,7 +7,11 @@
(string-length $4 $3) (string-length $4 $3)
(load $5 &terminal-str) (load $5 &terminal-str)
(syscall DEVICE-WRITE, $5, $3, $4) (syscall DEVICE-WRITE, $5, $3, $4)
(load $6 &new-line)
(string-length $7 $6)
(syscall DEVICE-WRITE, $5, $6, $7)
(halt))) (halt)))
(data (label terminal-str "/dev/term/0") (data (label terminal-str "/dev/term/0")
(label new-line "\n")
(label x 1.0) (label x 1.0)
(label y 2.0))) (label y 2.0)))