Computer Systems - Translators Flashcards
What are the two types of computer languages?
High-level
Low-level
What a high-level language?
A source code easy for humans to write but computers need to translate it before they can read it and run it
What is a low-level language?
Tricky for humans to read but easier for a computer to run
What do low-level languages consist of?
Machine code
Assembly code
What is machine code?
Very tricky for humans to understand - each processor (or family of processors will have its own specific machine code
What does machine code look like?
Binary - 000000 00001 00011…
What is assembly code?
More readable for humans and easier to remember
Why is it good if a code is easier to remember?
Programmers are less likely to make mistakes when wriitng assembly code than machine
When is assembly code used?
When developing software for embedded systems and when programmers need more control over specific hardware
What are the advantages of high-level languages?
The same code will work for many different machines and processors
The programmer can easily store data in lots of different structures (list and arrays) without knowing about the memory structure
Code is easy to read, understand and modify
How many instructions of machine code is high-level code?
One instruction of high-level code represents many instructions of machine code
What are the disadvantages of high-level language?
Must be translated before a computer is able to understand it
You don’t have much control over what the CPU actually does - programs will be less memory efficient and slower
How many instructions of machine code is assembly code?
One instruction of assembly code usually represents one instruction of machine code
What are the disadvantages of low-level code (machine code)?
Usually written for one type of machine/processor - won’t work on other
The programmer needs to know about the internal structure of the CPU - how it manages memory
Code is difficult to read, understand and modify
What are the advantages of low-level code (machine code)?
Commands in this code can be executed directly without need of a translator
You control exactly hat the CPU does and how it uses memory - memory will be more memory efficient and faster