Chp 7) High and Low Level languages - CS
Advantages of high-level language (Comprehend)
-They are closer to the language and sytanx that we as humans understand
How a compiler works?
-as a compiler translates the whole source code in one go, if there are any errors in the code it will not compile. The compiling process will stop and these errors will need to be removed before the program can be compiled -The machine code from the compiler is output an executable file (exe.) -An executable file is a file program that a computer can directly process -a report list of errors in the code is created -optimises the source code to run efficently
Advantages of high-level language (Easier to:)
-deug at the development stage -write in a shorter time -maintain once in use
Examples of high-level languages
-pascal -python -Java -c++ -c -BASIC
How an interpreter works?
1. translates a program one line of code at a time 2. machine code is directly executeed and the interpreter is used each time the program is executed 3. it will identify an error as soom as it finds one in a line of code
Advantages of high-level language (Compatiblity)
This type of language can be run in any type of computer unlike assembly language which is only specific to the hardware it runs on .
Features of a compiler (1)
Translates high-level language program into machine code
Features of a compiler (5)
a complied program is usually distributed for general use
Compiler
a computer program that takes a whole program written in high-level language and translates it into machine code. (A computer can only process machine code.)
Interpreter
a computer program that translates a program written in a high-level language line by line into machine code. Unlike a compiler which takes the whole of the source code and translates it in one go, an interperter translates the source code into machine code one line at a time 1.executes a high-language program a statement at a time 2. no executable file of machine code is produced 3. one high-level lanuage program statement may require several machine code instructions to be executed 4. interpreted programs cannot be used without the interpreter 5. an an interpreter is often used when a program is being developed
Executable file
a file format that a computer directly process. This file will contain the whole of the machine code needed for the CPU to process the program being written.
Assembly language
a low-level programming language that uses mnemonic codes to create programs
Driver
a program that controls a device for example a printer or a keyboard
Low-level language
a programming language that is closer to the native language of computers. They can be referred to machine code, the binary instructions that a computer understands or an assembly language that needs to be translated into machine code. -each line of code will only perform one task.
High-level languages
a programming language that looks like the language humans generally uses. This means that they are much easier to read and write programs compared to low-level language or machine code
Machine code
a series of binary numbers made of 1's and 0's
Features of a Compiler (2)
an executable file of machine code is produced
Features of a compiler (4)
compiled programs are used without the compiler.
Assembler
converts assembly language into machine code -an executable file of machine code is produced -one low-leve language statement is usually translated into one machine code intrustions -assemlbed programs can be used without the assembler -an assembled program is usually distributed for general use
Advantages of high-level language (Mistakes)
fewer mistakes are made when programming as not as much knowledge is needed for the languages that control the working of computer, such as machine code an assembly language
mnemonic codes
instruction codes used in assembly language
Features of high-level language compared to machine code
it deals with strucutures such as variables, arrays, loops, conditions, functions and procedures whereas machine code deals with memory addresses, registers and operation codes.
Features of a compiler (3)
one high-level language statement can be translated into several machine code instructions
Advantages of high-level language (Translation)
programmers can create programs using high-level language, and this can then be translated into machine code for a computer to process
Compiling
the act of running the source code through the compiler (compiling the code is essential to a computer understanding it.)
Source Code
the code produced by the programmer is called source code.
Syntax
the structure of language in a computer program
Where is low-level languages used?
they are still used to program certain software. Software applications such as device drivers for hardware, for example graphic card, need to communicate effectively with the computer they are connected to. This means the when you buy a piece of hardware such as graphics card or printer you will need to download the correct drivers that enable it to communicate with the computer in which it has been installed. -Without the driver, the two connot communicate. -Driver software is written in a low-level lanuage. Low-level languages are mostly still used where very close control of the processing in the CPU is needed