8.4 Translators And Facilities Of Languages Flashcards
In first computers, what were programs written in?
Machine code
Assembly language
More easy to write than machine code but it is processor specific and has to be translates into machine code before executed. Assembly language is a low level language
High level languages
Statements usually look like a bit of English or Maths. They also have data structures such as arrays and records.
How are high level languages translated?
A compiler or translater
Order of languages to components
High-level language -> Assembly language -> Machine code -> Hardware
High-level Advantages
Easier to learn, programs can be written faster, easier to understand and debug
Low-level advantages
Can run very quickly, uses less RAM, can be used to manipulate specific hardware componenets
Give a use for Low-level languages
Drivers
Compiler
- Source code written by programmer
- Translates the whole program to produce object code
- Executes much faster as it is already in machine code
- Can be saved in storage and run at any time
- Compiler doesn’t need to be present at run time
- Customers can’t see the code
Interpreter
- Translates a high-level language into machine code one line at a time and immediately executes it
- Take more time to be executed
- Interpreter must be installed
- Customers can see the source code
- If it reaches a syntax error, it stops and displays an error message
Compiled examples
Java is compiled into an intermediate stage called bytecode, bytecode can be interpreted on many different types of processors using an interpreter
Interpreter examples
Javascript, used in webpages is interpreted; the source code is included in the webpage and then interpreted in the browser