From 51a1e71c269f298fba18b620c68a0b1b15d236e9 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 24 Jul 2022 19:08:13 -0700 Subject: Improve the match syntax for constants. I guess you can pattern match using quote as a literal. That's pretty cool. --- csc/linker.csc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'csc/linker.csc') 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)) -- cgit v1.3.1