cmsc430 / langs

0 stars 0 forks source link

Recursive printing is broken #10

Open pdarragh opened 11 months ago

pdarragh commented 11 months ago

When we have self-referential heap structures, the output loops infinitely and must be interrupted:

> (let ([v (make-vector 1 #t)]) (begin (vector-set! v 0 v) v))
#0='#(#0#)
> (run (compile (parse '(let ([v (make-vector 1 #t)]) (begin (vector-set! v 0 v) v)))))
^Cuser break [,bt for context]

It'd be nice to implement a (simple) check for these cases and indicate the recursion somehow.

laelath commented 11 months ago

It looks like Racket resolves these by printing out the recursive equations i.e. for this example it prints #0='#(#0#).