3 ms·
It is interesting to see that this approach has been used by Niklaus Wirth in most of his compilers, see "Compiler Construction - The Art of Niklaus Wirth" by H
by lboasso 3y ago
It is interesting to see that this approach has been used by Niklaus Wirth in most of his compilers, see "Compiler Construction - The Art of Niklaus Wirth" by Hanspeter Mössenböck [0].
This technique was also described by David R. Hanson in "Code Improvement via Lazy Evaluation", 1980 [1] and "Simple Code Optimizations", 1983 [2].
[0] https://github.com/lboasso/oberonc/blob/master/doc/Moe00b.pdf https://github.com/lboasso/oberonc/blob/master/doc/Moe00b.pd...
[1] http://storage.webhop.net/documents/lazyevaluation.pdf http://storage.webhop.net/documents/lazyevaluation.pdf
[2] http://storage.webhop.net/documents/simpleopt.pdf http://storage.webhop.net/documents/simpleopt.pdf
- i_don_t_know 3y agoWirth’s book on Compiler Construction is available at https://people.inf.ethz.ch/wirth/CompilerConstruction/index.html https://people.inf.ethz.ch/wirth/CompilerConstruction/index.... The relevant section is 10.2. But its mechanism is the “inverse” of destination driven code generation as I understand it. In Wirth’s Item approach the callee picks a location and tells the caller where to look. Whereas in destination driven code generation the caller tells the callee where to put the result.
- lboasso 3y agoYou are right, but as you can see at page 11 (Figure 4 rightmost AST) of The Oberon System Family paper [0], Wirth's approach was extended to "hint" destinations as well. [0] https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/68908/eth-3424-01.pdf https://www.research-collection.ethz.ch/bitstream/handle/20....
- i_don_t_know 3y agoThanks for the pointer! I didn’t know that.