Levels of Language, Translators and IDE Flashcards
What are the 3 types of language a computer uses?
Machine code
Low-level language (Assembly code)
High-level language (Source code)
What are the 2 tools used to write and convert the language on a computer?
Translators
IDEs
What is machine code?
An instruction that can run inside a CPU and is in binary
What is assembly language called?
Low level language because it is almost the same as machine code
What is the instruction set of a CPU?
The complete set of commands available. Each type of CPU has its own instruction set
What are mnemonics?
The instructions within an assembly language, as they are much easier to remember than a binary number
What does assembly language consist of?
A set of mnemonic instructions, each of which has a machine code equivalent
Give an example of a machine code, followed by a mnemonic code
Machine Code - 2403
Mnemonic Code - ADD AL,3
Why is programming in assembly language difficult?
The programmer needs to know a lot about the hardware details inside the CPU
What is the disadvantage with writing in assembly code?
The code only works on a specific CPU family, so if you use a different CPU, you need to rewrite the code using a different version of assembly language
What is the main advantage with writing in assembly code?
Programs in Assembly run much faster compared to programs written in a high level language, because there is less code overall
Give an example of a program that is typically written in assembly
Device driver, used to directly control hardware such as a graphics card
Why were high level languages developed?
In order to make programming a lot easier for people, compared to coding in assembly language
What 2 main features does high level language have?
It has a set of keywords such as PRINT or IF
It has a set of grammar rules (syntax) which define how to combine them correctly
What does a programmer write in?
Source code (programming code) using the allowed set of keywords and its syntax rules
Give 2 examples of high level language code
Python
Java
What does machine-independent mean?
Programs written in high level language can be ported to different computers and still run
What does source code need to be converted into in order to run on the CPU?
Machine code
What piece of software converts source code to machine code?
Translator
What are the 3 different types of translator?
Assembler
Compiler
Interpreter
What does the assembler do?
It converts assembly code into machine code.
What does the complier do?
It converts convert programs written in a high-level language into machine code instructions, and then stores it in an executable file
What does the interpreter do?
It converts a single line of high level source code into machine code and then immediately runs it on the CPU
How does the complier translate code?
It reads all the source code in one go, examining each keyword and their arguments. It translates those keywords into a set of machine code instructions. The compiler will also check the code for basic syntax errors, and notify the user if it finds any
What is the linker?
The software that combines object files
What is an object file?
Sometimes a large program is broken down into several software modules. Each module is compiled into an object file which has machine code
How does the interpreter translate code?
It translates a single line of source code and then immediately carries out the resulting machine code instructions. Then it reads the next line of source code and does the same. It carries on doing this until the program is terminated
Why is the interpreter a bit slower than the complier?
Because of the source code -> translate -> run loop
What is the advantage with an interpreter?
It is excellent for developing and testing code as any errors show up immediately
What is the disadvantage with an interpreter?
The interpreter must always be present to run the source code. And the source code itself also needs to be available
What does IDE stand for?
Integrated Development Environment
What does an IDE do?
Brings all the tools necessary for coding into one application. The tools are designed to work seamlessly together
What are 8 typical features of an IDE?
Editor Project(s) explorer Asset library Runtime Environment Object Viewer Debug tools Translator Output Screen
What does the editor do?
Help you to write code efficiently and easily with aids such as colour coded highlighting, auto-completion and brace matching
What is the project explorer?
A window that shows project files and folders
What is the asset library?
A window that lists all the assets such as images, sound, media files in the project
What is the runtime environment?
It allows you to build the project from its files, compile it all and then run it as if the code was running on the target CPU
What is the object viewer?
Many languages allow you to create ‘objects’ visually, and these objects have ‘attributes’ or properties that you can view and alter from this window
What are the debug tools?
These allow you to spot and correct programming errors
What is the translator?
This is either a built-in compiler or a built-in interpreter depending on the language
What is the output screen?
The runtime environment includes an output screen that lets you see what the program is showing to the user as it runs