(define-module (backend generator allocate) #:use-module (backend utils assign-stack) #:export (expansion->allocate)) (define (expansion->allocate ast) (define (allocate n) (cond ((null? n) n) ((eq? (car n) 'tmp-ir) (list 'stack-ir (make-location (cadr n)))) ((list? (car n)) (cons (allocate (car n)) (allocate (cdr n)))) (#t (cons (car n) (allocate (cdr n)))))) (allocate ast))