translation models
play

Translation Models Machine-dependent Generate Machine Code - PowerPoint PPT Presentation

Translation Models Machine-dependent Generate Machine Code Directly Through Intermediate Code Machine-independent Interpret the source code Generate intermediate code and then interpret the intermediate code Single


  1. Translation Models • Machine-dependent – Generate Machine Code • Directly • Through Intermediate Code • Machine-independent – Interpret the source code – Generate intermediate code and then interpret the intermediate code

  2. Single Pass vs. Multi-pass • Single pass – No intermediate code – Limited code optimization – No intermediate files • Multi-pass – Intermediate code could be generated – Optimizations could be done on the intermediate code and the target code – Intermediate files created

  3. Implementing Compilers (1/3) • Bootstrap a compiler for L to run on a bare machine M 1. Choose S subset of L S M 2. Write a Compiler for S to run on M M 3. Write a Compiler for L in S L M S 4. Compile L written in S using the S-Compiler L M L M M S S M M

  4. Implementing Compilers (2/3) • Write a Cross Compiler for Language L that runs on machine (M) and generates code for machine (N). Assume that you have a compiler for L running on M L N M 1. Write a compiler in L in L that generate code for N L N L 2. Compile the compiler produced in step 1 on the compiler of L on M L N L N L M L M M

  5. Implementing Compilers (3/3) • Cascading is the process of conducting compilation in two steps: 1. Compile a program written in L to produced Intermediate Code I 2. Compile the program produced in code I into machine code M L I I M M M

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend