<< Previous exercise (5.7) | Index | Next exercise (5.9) >>
1. the value of a is 3
(define (extract-labels text receive)
(if (null? text)
(receive '() '())
(extract-labels (cdr text)
(lambda (insts labels)
(let ((next-inst (car text)))
(if (sysmbol? next-inst)
(let ((s (assoc next-inst labels)))
(if s
(error "Repeated label name" next-inst)
(receive insts
(cons (make-label-entry next-inst
insts)
labels))))
(receive (cons (make-instruction next-inst)
insts)
labels)))))))
1.
the value in register a is 3.