diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-24 19:08:13 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-24 19:08:13 -0700 |
| commit | 51a1e71c269f298fba18b620c68a0b1b15d236e9 (patch) | |
| tree | 10eb01e4afed9d636d7e20f36a676363a8359ad1 /csc/linker.csc | |
| parent | 192ab9c4e21bab8c08a640b349fa9630a9a672df (diff) | |
| download | chromatopelma-51a1e71c269f298fba18b620c68a0b1b15d236e9.tar.zst | |
Improve the match syntax for constants.
I guess you can pattern match using quote as a literal.
That's pretty cool.
Diffstat (limited to 'csc/linker.csc')
| -rw-r--r-- | csc/linker.csc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/csc/linker.csc b/csc/linker.csc index b840c15..feec289 100644 --- a/csc/linker.csc +++ b/csc/linker.csc @@ -22,12 +22,12 @@ (map (lambda (x) (match x - ((i . ((! 'if) label)) + ((i . ('if label)) ; Compute offset from the current position. Subtract 1 ; because the instruction pointer is incremented each ; time already. (list 'if (- (lookup label-map label) i 1))) - ((_ . ((! 'call) label)) + ((_ . ('call label)) (list 'call (lookup label-map label))) ((_ . opcode) opcode))) (enumerate program))) @@ -43,7 +43,7 @@ (i 0)) (match program ('() m) - ((((! 'label) name) . tail) + ((('label name) . tail) (loop (insert m name i) tail i)) ; N.b.: i instead of (+ 1 i) because we're going to remove the labels later. ((_ . tail) (loop m tail (+ 1 i)))))) @@ -52,7 +52,7 @@ (filter (lambda (opcode) (match opcode - (((! 'label) _) #f) + (('label _) #f) (_ #t))) program)) |
