graph reduction


graph reduction

A technique invented by Chris Wadsworth where an expression isrepresented as a directed graph (usually drawn as aninverted tree). Each node represents a function call and itssubtrees represent the arguments to that function. Subtreesare replaced by the expansion or value of the expression theyrepresent. This is repeated until the tree has been reducedto a value with no more function calls (a normal form).

In contrast to string reduction, graph reduction has theadvantage that common subexpressions are represented aspointers to a single instance of the expression which is onlyreduced once. It is the most commonly used technique forimplementing lazy evaluation.