Skip to main content

Assemblers and Interpreters


Assemblers

In the early days of programming, machine code (binary) was the only option. Unfortunately this was laborious, prone to error and difficult. A slight improvement on this was the use of hexadecimal or octal which reduced the number of errors and the time to enter the program. Eventually assembly languages were developed which were easier and more productive to use whilst preserving the speed and compactness of machine code.
Assembly languages vary from one type of computer to another (or more correctly from processor to processor) which results in a difficulty in transporting programs from one computer to another. 
Assemblers are the simplest of all the translators to understand since the majority of the statements in the source code are mnemonics (short words that help you to remember something) representing specific binary patterns - the others being labels, directives (or pseudo-ops) which give instructions to the assembler. 
So, for instance, rather than enter the binary pattern 01011100 which might mean “Increment the contents of the Accumulator by 1” we could type in the mnemonic “INC” which the assembler would translate into the appropriate binary pattern.

Interpreters

An interpreter is another common kind of language processor. Instead of producing a target program as a translation, an interpreter appears to directly execute the operations specified in the source program on inputs supplied by the user, as shown in Fig.




Comments

Popular posts from this blog

Structure of Compilers

Mapping of a source program into a semantically equivalent target program is divided into two parts: analysis and synthesis. The analysis part breaks up the source program into constituent pieces and imposes a grammatical structure on them. It then uses this structure to create an intermediate representation of the source program. The analysis part also collects information about the source program and stores it in a data structure called a symbol table, which is passed along with the intermediate representation to the synthesis part. The synthesis part constructs the desired target program from the intermediate representation and the information in the symbol table. The analysis part is often called the front end of the compiler; the synthesis part is the back end. Compiler operates as a sequence of phases, each of which transforms one representation of the source program to another. These phases are: Lexical Analysis The lexical analyzer is the interfac...