blob: 193cadb153673b03597bded84a30944a73a6ae13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
(define-module (modules generator allocate)
#:use-module (modules 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))
|