Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
out of 8
Post on 21-Dec-2015
<ul><li> Slide 1 </li> <li> Compilers and Interpreters </li> <li> Slide 2 </li> <li> Translation to machine language Every high level language needs to be translated to machine code There are different ways to do it Two main ways are compilers and interpreters Whats the difference? Compilers are more thorough, generate faster executables and the executable is easier to distribute Interpreters are more dynamic, are easier to use in the development stage of a program </li> <li> Slide 3 </li> <li> A compiler Compilers are more thorough When they translate source code to machine code (object code) they translate (ideally) the entire program If they encounter a syntax error, they report it but they also try to continue the translation process Compiling a buggy program might cause hundreds of error messages (compilers are easily confused!) Programmers learn to fix the first one reported then try another compile When a program is successfully compiled, there exists a stand-alone file which has the executable code in it, ready to run by giving it to the CPU </li> <li> Slide 4 </li> <li> Interpreters, on the other hand, Interpreters are more dynamic They translate a statement at a time, then hand the resulting machine code to the CPU which executes it Then they translate the next statement of the program, give it to the CPU which executes it And this process continues until the program is over OR a syntax error is encountered The executable code is not saved in a runnable form, it is generated on the fly and mostly discarded when the program is done The FIRST syntax error the interpreter runs into ends the program execution process right there. No other code is translated at all. </li> <li> Slide 5 </li> <li> Distributing programs A compiled program has an exe file, which can run on any computer that has the right CPU the computer does not have to have the compiler application installed An interpreted program NEEDS the interpreter available to run, so if you give a copy of your program to a friend, they will need to get Python also in order to run your program </li> <li> Slide 6 </li> <li> Speed of execution Compiled programs have complete executable files, they dont need any more translation they run fast Interpreted programs need to have the interpreter available and they will be translated every time the program is executed they are slower </li> <li> Slide 7 </li> <li> Implications for Python In an interpreted program, if a statement is not executed, it is not translated Which means if there is a syntax error in the program, it will not be detected until that particular part is executed Which means TESTING is very important! Example: a function definition in the program has a syntax error in it, but the function is not called when the programmer is testing the whole program that error will NOT be detected So you must be thorough enough in your testing to make sure all your code gets executed at least one time! </li> <li> Slide 8 </li> <li> More implications for Python There are languages which have only one or the other, not both, so you use what you have Python is usually interpreted, the interpreter is given away for free There are Python compilers available Most programmers like Python for being quick to write a program in They use Python to develop the program, then compile it to distribute it (or sometimes convert it to a compiled language like C for speed) </li> </ul>
View more >
1 What are Compilers? Translates from one representation of the program to another Typically from high level source code to low level machine code or object.
Compilers and Interpreters. HARDWARE Machine LanguageAssembly Language High Level Language C++ Visual Basic JAVA Humans.
C compilers for 8051 Chin-Shiuh Shih. Assembly Language Machine Dependent Executable Machine Code Symbolic version of machine code Machine dependent Direct,
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
SIGHT TRANSLATION AND WRITTEN TRANSLATION Translation and Written Translation: Guidelines for Healthcare Interpreters I. Introduction Language professionals are often assumed to be able to ...
Language translation Language implementations cherung/teaching/2010cs1356/2_03.pdfHow to translate a C program to machine code? ... Infix, prefix, postfix notation
Machine Language, Assemblers, and Compilers machine language Hides: bit-level representations, ... Here are macros for breaking multi-byte data types into byte-sized chunks ... Contemporary compilers go far
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
From High Level to Machine Code - High Level to Machine Code Hardware ... Compiler Web browser Java Interpreter Java ... Author: ARIK
Chapter 11 - The C Language. BYU CS/ECEn 124The C Language2 Topics to Cover… ISR’s High Level Languages Compilers vs. Interpreters The C Language 1 st.
Lecture 1: Introduction to Java Languages Machine Language Assembly Language High‐Level Language Assemblyygg…
Statistical Machine Translation Raghav Bashyal. Statistical Machine Translation Uses pre-translated text (copora) Compare translated text to original.