1/3
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Give the characteristics and purposes of the different types of programming languages
Low level languages and high level languages.
Low level languages do not resemble natural human language, making it harder to read, write, understand and learn.
Purpose:
Used when a program must be executed quickly (as the computer doesn’t have to translate it; can be directly understood)
Provides direct control over hardware
High level languages use code written in a way that is similar to a natural human language, making it easier to read, write, understand and learn the language.
Purpose:
leads to fewer errors, easier to debug
easier to write, read, understand and learn
allows for more complex and powerful commands
However, high level languages must be converted into machine code before it can be run, as high level languages cannot be executed directly by the CPU, making it slower to execute.
What does a translator do?
Changes (translates) a program written in one language into a program written in another language (usually machine code)
Explain the two different types of translators
Interpreters: converts high level languages into machine code and executes them one line at a time
Compilers: converts a high level language into machine code for execution at a later time by creating an executable file; the entire program is converted at once
Compare interpreters and compilers
Execution method:
Interpreters: translates source code and executes it one line at a time
Compiler: translates all of the source code all in one go and produces an executable file that will run on other machines without the compiler needing to be installed
Execution speed:
Interpreters: slower as the code must be retranslated each time the program is run
Compiler: when it creates the executable file, it produces much more efficient code, making the compiled programs run faster
Complexity:
Interpreters are much smaller, simpler programs
Compilers tend to be large, complex programs
Error reporting:
Interpreters: the interpreter translates one line at a time, so when it encounters an error in a line it will stop the program from running and report it to the user immediately
Compilers: the compiler analyses the entire program taking note of where errors have occurred and records them in an error file, and provides this to the user
Repetition:
Interpreters: can be edited and run without translating the whole program; the entire program must be retranslated every time
Compilers: requires analysis and generation of the code and executable file only once; however compiled programs have to be recompiled after any changes have been made