Abstract

The G-machine is a stack machine for von-Neumann-like execution of lazy functional languages, using graph reduction. This paper describes how target code generation from G-machine code is performed in a compiler for Lazy ML. We briefly review the G-machine, and the compiler phases preceding the target code generation. Two different target code generation methods are described, as well as essential parts of the run-time system. The first target code generator is very simple, generating naive code by means of ‘macro expansion’. This code explicitly manipulates the stacks exactly as prescribed by the G-machine instructions. A simple peep-hole code improver can remove a fair amount of the most glaring inefficiencies of the naive code. The second target code generator is less naive, and takes a more systematic approach to avoid redundant operations in the resulting target code. This code generator can be neatly expressed as an attribute grammar over the G-machine code sequence.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.