language implementation methods david woolbright
TRANSCRIPT
![Page 1: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/1.jpg)
Language Implementation Methods
David Woolbright
![Page 2: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/2.jpg)
Interpretation
• Interpretation occurs when the code that represents a program is read and causes an action or change in state of the executing machine.
• Interpretation can occur in hardware or software
![Page 3: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/3.jpg)
Implementation of Languages
There are three general methods for implementing a language
Method 1: Compilation – The source program is translated into machine code (0’s and 1’s) which is interpreted by hardware
- Slow translation
- Fast execution
![Page 4: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/4.jpg)
Compilation Process
(Sebesta Diagram)
![Page 5: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/5.jpg)
Pure Interpretation
Method 2: Pure Interpretation – The source code is unchanged. An interpreter program executes reading your source as data to determine how to “execute” your program
- Slow execution
- Very flexible
![Page 6: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/6.jpg)
Pure Interpretation (Sebesta Diagram)
![Page 7: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/7.jpg)
Hybrid System
Method 3: Hybrid System - The source code is partially translated to an intermediate format. This intermediate code is input to an interpreter.
– Small translation cost
– Medium execution speed
![Page 8: Language Implementation Methods David Woolbright](https://reader035.vdocument.in/reader035/viewer/2022072112/5697c01e1a28abf838cd14f1/html5/thumbnails/8.jpg)
Hybrid System(Sebesta Diagram)
- Small translation cost- Medium execution speed