2.5
No description yet. This curated deck is ready for daily study.
Card preview (14)
What is a compiler?
• Translates source code from high level languages into machine code • Whole program is translated into machine code in one go into an executable file before run
What are the advantages of a compiler?
• No need for translation software at run-time • Faster execution speed • Code is optimised
What are the disadvantages of a compiler?
• Will not run with syntax errors (hard to debug) as the errors are reported at the end • Code needs to be recompiled when the code is changed
What is an interpreter?
• Translates source code from high-level languages into machine code • Translated line by line as the program is running
What are the advantages of an interpreter?
• Easy to write source code, program will always run, until it finds a syntax error • Easy for beginners to learn to write code
What are the disadvantages of an interpreter?
• Translation software is needed at run-time • Slower execution speed • Code is not optimised
What is a high level language?
• Source code is aimed at humans • Structure and syntax similar to English • Must be translated to machine code by a compiler/interpreter • Works on different types of processors • Easy to write and understand code • Less memory efficient • Slow execution if not optimised • Large number of instructions • One source code = multiple machine code instructions • e.g. python, java, c++
What is a low-level language?
• Translated by an assembler into machine code • Used for embedded systems/device drivers (instructs hardware directly) • One source code instruction = one machine code instruction • Instructions are specific to processor • Limited to a set of instructions • Harder to write and understand code • Fast to execute • e.g. machine code (uses binary), assembly language (use mnemonics)
What do translators do?
• Translates source code written in a high level language into machine code • Translates assembly code written in a low level language into machine code • e.g. compiler, interpreter, assembler
What does an Integrated Development Environment (IDE) include?
• Code editors to enable program code to be entered • Error diagnostics for debugging • Run-time environment to test and run the program • Translator to convert high level code to machine code
What are the editing features of an IDE?
• Colour coding keyword syntax and auto completing command entry • Highlighting syntax error in code • Automatic indentation
What are the debugging features of an IDE?
• Breakpoints to stop code at a certain point • Going through lines one at a time to check the lines being executed • Tracing through a program to output the values of variables
What are the two features of an IDE that provide a run-time environment?
• Output window • Simulating different devices the program can run on
What are error diagnostics?
• Tools provided by IDEs that give detailed feedback on errors in your code