Notes > Computer Systems > Assemblers and Compilers
|
Assemblers involve a set of concepts that enable code to be written in a language and then used to control the computer's operations. These concepts include the assignment of labels to represent locations in memory (e.g. letters such as X, Y, Z). Fixed names are given to operations such as STORE, LOAD and ADD as well as registers (e.g. R1, R2). Numbers written in decimal are also converted to binary.
Each line in assembly language translates to a single machine code instruction. Assembly languages are machine specific and require an understanding of the structure of the machine in order for that machine to be used to its potential. Assembly language is also very hard to learn.
FORTRAN was an early language that appeared around the same time as COBOL and it was very similar to assembly code. COBOL came along in about 1956 and it combined assembly code instructions into an easier to write language.
Some other languages:
- BASIC (Beginner's All-purpose Symbolic Instruction Code) - a simple language originally designed for beginners and students
- C (1972)
- PASCAL (designed early 1970s) - originally designed for simplicity in order to teach programming
- C++ (1986) - commonly used object-oriented language
- VB (1991) - visual programming system designed by Microsoft
- Java (1995) - very popular, portable, object-oriented language similar to C++
Programming languages involve declarations of variables, literals and constants. Variables in a programming language are simply labels pointing to a location or they represent a type of data. Constants are labels for literals which are bit patterns.
There are four main types of imperative instructions within programming languages. These are Assignments, Expressions, Control Statements, and Procedural Units (which are also known as methods).
An example of assignment is "X=21". Here the decimal value is assigned to the label "X". An expression does not involve an equals sign (=) but it involves variables and values which are put together in a statement. For example, "21*(X+Y)" is an expression.
Control statements are loops or statements that specify conditions for code to be executed for example. Examples of control statements are the "if...then...else..." loop, the "do...while..." loop, and the "for..." loop. Procedural units or methods are words such as "call" or "return".
Languages that involve a compiler (such as Java) all have common components of the language that are recognised by the compiler:
- Identifiers - these are labels that identify items or locations. They are specified by the programmer and it is up to them what they are called
- Declarations - specify what the identifiers refer to (i.e. what they mean)
- Statements - provide details of when to carry out specified calculations or tasks
- Expressions - calculations that are to be carried out
White space and comments in code is ignored by the compiler. The compiler carries out its job by breaking all of the inputed code into separate words then the "grammar" of the code is analysed by the compiler when the program is compiled. A programming language's grammar is known as its syntax and "syntax analysis" is known as "parsing". The compiler finally generates the machine code that can be executed by the CPU.
Try a Computer Systems Quiz in the Computing Students Computing Quizzes Section to test your knowledge.
Search for "Assemblers and Compilers" on:
Google |
Kelkoo |
Amazon |
eBay (UK) |
eBay (US)
Search for "Assemblers and Compilers" on the rest of Computing Students: Assemblers and Compilers
|