Compiler Programming Basics by Michael Dsouza & Michael Dsouza
Author:Michael Dsouza & Michael Dsouza [Dsouza, Michael]
Language: eng
Format: azw3
Publisher: UNKNOWN
Published: 2017-04-28T04:00:00+00:00
7.3 The intermediate language
In this chapter we have chosen a fairly low-level fine-grained intermediate language, as it is best suited to convey the techniques we want to cover. We will not treat translation of function calls until chapter 10, so a “program” in our intermediate language will, for the time being, correspond to the body of a function or procedure in a real program. For the same reason, function calls are initially treated as primitive operations in the intermediate language.
The grammar for the intermediate language is shown in grammar 7.1. A program is a sequence of instructions. The instructions are:
• A label. This has no effect but serves only to mark the position in the program as a target for jumps.
• An assignment of an atomic expression (constant or variable) to a variable. • A unary operator applied to an atomic expression, with the result stored in a variable.
7.4. SYNTAX-DIRECTED TRANSLATION 151
• A binary operator applied to a variable and an atomic expression, with the result stored in a variable.
• A transfer from memory to a variable. The memory location is an atomic expression.
• A transfer from a variable to memory. The memory location is an atomic expression.
• A jump to a label. • A conditional selection between jumps to two labels. The condition is found by comparing a variable with an atomic expression by using a relational operator (=, =, <, >, ≤ or≥).
• A function call. The arguments to the function call are variables and the result is assigned to a variable. This instruction is used even if there is no actual result (i.e, if a procedure is called instead of a function), in which case the result variable is a dummy variable.
An atomic expression is either a variable or a constant.
We have not specified the set of unary and binary operations, but we expect
these to include normal integer arithmetic and bitwise logical operations. We assume that all values are integers. Adding floating-point numbers and
other primitive types is not difficult, though.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9912)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8295)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7761)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6814)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6543)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6410)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Kotlin in Action by Dmitry Jemerov(5062)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4316)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3990)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3780)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3722)
The Ultimate iOS Interview Playbook by Avi Tsadok(3699)
