6 Types Of Languages And Translators Flashcards
What are the three types of translator?
- Assembler
- Interpreter
- Compiler
How do interpreters work?
- Interpreters go through the source code and translate one line at a time.
- As soon as the line has translated it is run.
- If it reaches a syntax error the translator stops
How do compilers work?
- The compiler translates all the lines of code at once
- If there is a syntax error nothing will be translated
- If there isn’t then it produces an executable machine code file
Why and what are interpreters used for?
- Interpreters are used for testing.
- They are initially faster at translating than compilers
- They translate up to a syntax error making error trapping easy
- The source code is processor independent
Why and what are compilers used for?
- Compilers are used for translating the final piece of code to give to a client
- They create a machine code file so source code doesn’t have to be given out
- Once translated the machine code runs faster
- Once translated translation software is no longer needed
What is a 1st generation language?
Machine code
Written in 1s and 0s
Code has to be written uniquely to each processor
What is a 2nd generation language?
Assembly code
Translated using an assembler
Simple commands that have a direct binary equivalent
E.g. CISC instruction set
Give an example of a 2nd generation language
CISC instruction set
What is a 3rd generation language?
English like syntax that has no binary equivalent
Translated using interpreter or compiler
Imperative
E.g. python
Benefits and features of a 3rd generation language
Easy for humans to understand.
Machine independent
Has a runtime environment
Has syntax highlighting
What is a 4th generation language?
Declarative meaning written in English like commands that tell the computer what to do but not how to do it.
E.g. SQL
What is imperative programming?
When the programmer writes the instructions that the computer exactly follows to execute a task
What is declarative programming?
When the programmer writes commands telling the computer the information needed but not how to get it. Used in data base management
Name 2 advantages of low level languages
- Allows closer control of registers and cpu
- Do not need translating so they run faster
What is bytecode?
Also known as intermediate code bytecode is an intermediate language that is executed on virtual machines.
What is the advantage of bytecode?
Allows platform independence as it can run on any computer that has the virtual machine installed.
What is the disadvantage of bytecode?
Typically slower than normal code