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