2.5.1 Languages Flashcards
What is a high-level programming language?
A high-level language has a syntax and structure similar to English that is designed to be understood by humans
Why is a translator necessary?
High-level languages have to be converted into machine code (binary) in order to be processed. In order to convert high-level languages into machine code we must use a compiler or interpreter.
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 2 differences between compilers and interpreters?
-A compiler translates the whole program in one go and an interpreter translates the code line-by-line.
-A compiler would produce all the errors in a file at the end of compilation while an interpreter stops translation when it finds an error. This is useful for debugging.
-A compiler produces an executable file which does not need to be compiled again. With an interpreter the original code must be interpreted every time it is run.
-There is no need for the compiler to be present when the object/executable file is run. The interpreter must be installed to run the program.
What are the benefits of using a compiler?
-Compilers produce an executable program: There is no need to repeat this process more than once per version of the software.
-Compilers hide the source code from the end user: This helps to protect developers’ intellectual property.
-No source code needed afterwards
-Fast to execute afterwards
What are the drawbacks of using a compiler?
-The compilation process can be very slow: This can slow down development if many small changes need to be made. However, it is faster than an interpreter.
-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 central processing unit as long as there is an interpreter available for the platform.
-Errors discovered straight away
What are the drawbacks of using an interpreter?
-Running an interpreted program is slower than a compiled program
because we have to translate each line every time we run the software. But it is quicker to get started which can be good for small changes.
-Source code needed to run
-Slower to execute
What is a low-level language?
A language that does not closely resemble a natural human language, making it harder for humans to understand and write in.
What are the 2 forms of low-level language?
Machine Code (Binary)
and
Assembly Language (Specialised commands - bits + English
State the pros/cons of high-level languages
-High-level languages are more easily written by humans
-High-level languages are more easily understood by humans
-High-level languages are portable (can be run on many different CPUs)
-High-level languages are slow to execute
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