Percolation rules make the code more C-like, by moving statement-like forms to the outer parts of the code. The most important reason for doing this is to ensure that while forms are removed from locations where they cannot syntactically occur in C (e.g. inside a form headed by +). Also, these transformations tend to make the code more human-readable and easier to pretty-print, which is vital for debugging purposes.
If the code is to return values to its caller, the code is first wrapped in a return form. The percolation rules will move this return form inward, so that it directly encloses the forms whose value will be returned.
During percolation, the following simplifications are done:
Because percolation follows scanner substitution, it does not know how to handle scan forms.
Percolation must be called after type inference has been done at least once. Type inference must coerce the two branches of a binary-if to the same value before percolate-set is run. Bad things happen if percolate is run first.
Percolation does not require that type markings still be present. If they are present, it preserves some of them but not all.
Ownership, Maintenance and Disclaimers
Last modified