Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE240 (online) Lecture 04

CSE240 (online) Lecture 04

Introduction to Programming Languages
Program Processing
(201805)

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. CSE240 – Introduction to Programming Languages (online) Lecture 04: Program

    Processing Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu Office Hours: By appointment
  2. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    3 Program Processing: Interpretation Interpreter is a program that translates in runtime and executes each statement in the high level-language. Advantages: § No separate compilation phase (quicker program development); § Good debugging information since the source code is being executed. Disadvantages: § Slow execution § Can use more memory space
  3. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    4 Program Processing assembler linker compiler
  4. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    5 Program Processing: Compilation Compiler is a program that translate the entire code from source to assembly code/machine code. Linker resolves external references (e.g., bring in code from libraries) object code (binary) linker Executable binary for a specific machine other objects source program assembler assembly program compiler
  5. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    6 Program Processing: Compilation Compiler is a program that translate the entire code from source to assembly code/machine code. Linker resolves external references (e.g., bring in code from libraries) Advantages: • Faster than interpretation • Good for multi-module programs Disadvantages: • Separate compilation phase • May lose debugging info
  6. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    7 Program Processing Program Processing Interpretation LISP Prolog Compilation C C++ Two Step Translation with Intermediate Code Compilation + Interpretation Java Compilation + Compilation C++ (.Net Solution) C# (.Net Solution)
  7. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    8 Program Processing: Intermediate Code (Java) Intermediate code make the language and compiler machine-independent. This concept was implemented in 1970’s to simplify the compiler design. It is used in Java. bytecode Java program javac Java virtual machine Interpreter on a specific machine Simulator or Hardware source program intermediate code Virtual machine compiler
  8. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    9 Program Processing: Intermediate Code (Microsoft .Net) Microsoft uses an intermediate code for its Common Language Runtime (CLR) environment (.Net Runtime Environment), which is independent of languages Prolog F# X F# compiler Prolog compiler X compiler JIT AND CLI C# Languages MS IL Just-In-Time compiler Intermediate Language Common Language Infrastructure Compilers C# compiler C++ C++ compiler C C compiler Simulator or Hardware
  9. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    10 Program Processing: Intermediate Code Intermediate code make the language & compiler machine-independent. This concept was implemented in 1970’s to simplify the compiler design. Advantages: • A single compiler for all machines • A small virtual machine (interpreter) that even fits in a web browser Disadvantages: • Slow execution and memory space • Separate compilation phase and may lose debugging info
  10. Javier Gonzalez-Sanchez | CSE 240 (online) | Fall 2017 |

    11 Program Processing Program Processing Interpretation LISP Prolog Compilation C C++ Two Step Translation with Intermediate Code Compilation + Interpretation Java Compilation + Compilation C++ (.Net Solution) C# (.Net Solution)
  11. CSE240 – Introduction to Programming Languages (online) Javier Gonzalez-Sanchez [email protected]

    Fall 2017 Disclaimer. These slides can only be used as study material for the class CSE240 at ASU. They cannot be distributed or used for another purpose.