Unit 4.2 - types of programming languages, translators and IDES Flashcards
What is machine code?
The list of instruction written in binary that a CPU can process. Each type of processor has its own Instruction Set.
Why do we have programming languages?
It is possible to write code in binary, bit it’s time consuming, difficult and error-prone.
What are high-level languages (advantages & disadvantages, examples)?
A high-level language is a type of programming language that allows programmers to use keywords/natural language statements, such as ‘while’, ‘if’, etc., to express programs. These languages offer a high level of abstraction, allowing programmers to focus on general algorithmic concepts rather than the specific details of the underlying hardware.
Example: Python, Java, C/C+, Visual Basic, etc
+ programmer friendly - easy to understand, debug and code; portable; programmers do not need to have deep understand of underlying computer hardware; portable/cross-platform (software that can be used on different types of computers or digital systems).
- needs more memory and storage; code may be slower to run; requires compiler/interpreter to be translated into machine code
What are low-level languages (advantages & disadvantages, examples)?
A type of programming language which allows programmers to express machine code instructions using simple commands, called mnemonics (e.g. ADD = add the value held in MAR to the one in ACC). These languages were written for a specific processor and are closely linked to machine architecture, therefore have low levels of abstraction.
Example: Assembly
+ highly efficient/fast execution speed; no compilers/interpreters needed; less memory required; direct memory addressing and hardware control
- non-portable (code cannot be used on different processors), difficult & time consuming to read, code and debug; requires assembler; requires detailed knowledge of underlying computer hardware
Used to program hardware specific codes such as device drivers, or control programs in embedded systems.
What does a high level of abstraction mean?
The higher the level of abstraction, the more removed a program is from direct control of the CPU
What is an assembler?
A type of translator/program that translates assembly language into machine code. It takes basic commands and converts them into binary code that can be recognized by a specific type of processor.
The mnemonics used by programmers are received by the computer and looked up in a table. If a match is found, the word is replaced with a sequence of binary 1s and 0s.
What is a translator?
Software that translates source code into machine code to be executed by the CPU.
3 types: Assembler, Compiler and Interpreter.
What are interpreters?
A type of translators which translated from high-level languages straight to machine code. It translates one line at a time, executes the line of code, and then moves on to translating the next line. The interpreter will translate and execute correct code up to the first point of error, then stop and report the error
+ easy to write source code as program stops when it finds syntax error; code does not need to be recompiled when it’s changed;
- slower execution of code; interpreter software is required every time to code is executed.
What are compilers?
A type of translators which translates an entire program in one go. It translates from source code to object code and then to machine code. An executable file contains the object code. If the compiler detects any errors in the code, it will not be able to translate it and will not produce an executable file. Once a program has been complied, a compiler is no longer needed to rn the program.
What is source code?
A group of instructions a programmer writes using computer programming languages.
What is object code?
A portion of a machine code which has not yet been linked into a complete program.
What does it mean to compile?
The process of converting source code into machine code.
What are IDEs?
Integrated development environments is a software application designed to help programmers develop software. They have tools to held write code by making the process faster, easier and less error prone.
State and explain 5 possible tools in IDEs
- Source code editor - auto completion, auto-correction, prettyprint (e.g. auto indentation)
- Built in translator (compiler or interpreter)
- Run time environment - provides set of hardware and software resources needed by a computer to execute a program. E.g. providing output window
- Debugging tools/error diagnostics for logic error - set of tools that allow a programmer to test a programs functionality
- Helping identify and prevent syntax errors - error highlighting, producing error message
Give 3 examples of error diagnostics tools
- Breakpoints - stop the execution of a program at a specific line and allow the programmer to step through the code line by line
- Translator diagnostics - messages generated by a compiler/interpreter when translating source code. May point to cause of error
- Watch variables - allows the developer to keep track of changing values of variables during program execution