microsoft / Trieste

A term rewriting system for experimental programming language development.
MIT License
37 stars 20 forks source link

Fix recursive stack depth problems. #94

Closed mjp41 closed 5 months ago

mjp41 commented 5 months ago

The rewrite engine used an efficient path based traversal that was iterative with effectively pre and post-order actions. This PR factors that into ast.h, and then uses it for various operations to prevent stack overflow on deep asts.

It also fixes the recursive delete problem that you get from shared_ptr, by building a work list of nodes that need to be destructed.