Two aspects of compilation are:
- Generate code to implement meaning of a source program in the execution domain (target code generation)
- Provide diagnostics for violations of PL semantics in a program (Error reporting)
There are four issue involved in implementing these aspects (Q. What are the issue in code generation in relation to compilation of expression? Explain each issue in brief. (June-13 GTU))
- Data types : semantics of a data type require a compiler to ensure that variable of a type are assigned or manipulated only through legal operation Compiler must generate type specific code to implement an operation.
- Data structures: to compile a reference to an element of a data structure, the compiler must develop a memory mapping to access the memory word allocated to the element.
- Scope rules: compiler performs operation called scope analysis and name resolution to determine the data item designated by the use of a name in the source program
- Control structure: control structure includes conditional transfer of control, conditional execution, iteration control and procedure calls. The compiler must ensure that source program does not violate the semantics of control structures.
Add caption |