; input: a list of binds ((x . y) (y . 3))
; returns: pair of verts, edges ((x y) . (x . y))
(define (graph bs)
+ (define (go bs orig-bs)
(define (find-refs prog)
(ast-collect
(lambda (x)
(case (ast-type x)
; only count a reference if its a binding
- ['var (if (assoc x bs) (list x) '())]
+ ['var (if (assoc x orig-bs) (list x) '())]
[else '()]))
prog))
(if (null? bs)
(rest (if (null? (cdr bs))
(cons '() '())
- (graph (cdr bs))))
+ (go (cdr bs) orig-bs)))
(total-verts (cons vert (car rest)))
(total-edges (append edges (cdr rest)))]
(cons total-verts total-edges))))
+ (go bs bs))
(define (successors graph v)
(define (go v E)