translators Low level and high level languages Compiler • A COMPILER is a computer program that translates a program written in a high-level language (HLL) into machine code.
• The compiler takes your high level source code and
converts it into machine code. The machine code representation is stored and saved as an executable. This executable can be run directly on the computer without recompilation. Compiler • The machine code created is specific to the specific architecture.
• If there is an error in the high level code, then no
translated code will be produced. Instead you will be given an error report of all of the errors. Compiler • Translates the whole program as a complete unit / at once • Creates an executable file / object code • A report / list of errors in the code is created • Optimises the source code (to run efficiently) Compiler Interpreter • An interpreter takes a single statement in your high level source code and converts it to machine code. It then immediately executes the statement and then moves onto the next statement. You code is translated and executed line by line.
• The machine code is never saved.
• Your program is running while this happens.
Interpreter • If there is an error in the high level code, then the user/programmer will be told which line is producing an error.
• The programmer can then correct the error and resume
interpretation/execution. Interpreter • Translates a program one line of code at a time • Machine code is directly executed // The interpreter is used each time the program / code is executed • Will identify an error as soon as it finds one in a line of code Interpreter • Translates high-level language into machine code/low level language • Translates (the source code) line by line/statement by statement • Stops if it finds an error • Will only continue when error is fixed Interpreter Why use complier over interpreter Creates an executable file • … so, would not release source code • … so, the source code cannot be stolen/edited. • … so, would not need to be translated every time // so, translator is not required • … making it machine independent Differences An interpreter translates and executes the code line by line • … whereas a compiler translates and executes the whole code all in one go
An interpreter stops translating and reports an error as it
finds one • … whereas a compiler produces an error report at the end of translation
An interpreter does not produce an executable file
• … but a compiler does produce an executable file Differences An interpreter will execute the code until it finds an error • … whereas a compiler will not execute any code if there are errors present
An interpreter allows correction of errors in real-time
• … whereas a compiler needs to retranslate the code each time after errors are found and corrected Differences Assemblers An assembler is a program that takes assembly code and converts it into machine code.
We can store the results of this translation so that we do
not need to reassemble at a later date. Assemblers Assemblers Assemblers IDE IDE IDE IDE IDE IDE An integrated development environment (IDE) is a software application that helps programmers develop software code efficiently.
It increases developer productivity by combining
capabilities such as software editing, building, testing, and packaging in an easy-to-use application. IDE Common features: • editors • run-time environments • automatic line numbering • error trapping • colour coding • breakpoints • variable tracing • auto-correct • auto-suggestion • auto-indent • interpreters IDE Many brands of IDE exist:
• Python comes with a simple IDE called IDLE.
• Eclipse and Netbeans are two fully featured IDEs often used for programming in Java, JavaScript and HTML. • Visual Studio is an IDE largely designed to help programmers in Visual Basic and C#.