2.5 - Languages & Translators Flashcards
What is a high-level programming language?
- Uses syntax similar to a natural human language to make it easier to understand and use
- Must be translated into machine code before it can be run
What are the pros/cons of high-level languages?
- More easily written and understood by humans
- Portable (can be run on many different CPUs)
- Slow to run
What is a low-level language?
Does not closely resemble a natural human language making it harder for humans to understand and use
State the pros/cons of low-level languages
-Low-level languages are easier to optimise
-Low-level languages allow the user to directly manipulate memory
-Low-level languages are specific to particular CPUs
What are the two types of low-level language?
- Machine Code
- Assembly Language
What is machine code?
Binary
What is assembly language?
Uses specialised command mnemonics to perform actions
Why do computers use binary?
Computers are made up of millions of transistors (switches) which can only represent two states (ON and OFF)
What are the two types of translator?
- Interpreter
- Compiler
What are 2 differences between compilers and interpreters?
Execution method:
- Interpreters translates the source code into machine code line-by-line
- Compilers translate all the source code into machine code in one go and produce an executable file
Execution speed:
- Interpreters are slower than compilers because the code must be reinterpreted each time the program is run
- Compilers can produce much more efficient code than interpreters, making the compiled programs run faster
Complexity:
- Interpreters are smaller, simpler programs
- Compilers are large, complex programs
Error reporting:
- Interpreters report errors to the user immediately and stops translation
- Compilers produces all the errors in an error file at the end of compilation
Repetition:
- Interpreters must reinterpret the program every time
- Compilers doesn’t need reinterpretation, but must be re-compiled after changes are made
What are the benefits of using a compiler?
- Produces an executable program: No need to repeat this process more than once per version of the software
- Hides the source code from the end user: Protects developers’ intellectual property
- Source code not needed afterwards
- Fast to execute afterwards
What are the drawbacks of using a compiler?
-Very slow compilation process: This can slow down development if many small changes need to be made
- Errors only shown right at the end
What are the benefits of using an interpreter?
-Interpreted languages are ‘portable’: This means that they can be run on many different types of CPU as long as there is an interpreter available for the platform
- Errors discovered straight away
- Good for small changes
What are the disadvantages of using an interpreter?
- Source code needed to run
- Slower to execute
What is the purpose of the IDE (Integrated Development Environment)?
Provides programmers with tools to help create programs