|✅ Paper Type: Free Essay||✅ Subject: Information Technology|
|✅ Wordcount: 2187 words||✅ Published: 1st Jan 2015|
Machine Language (a native language of the computer) is a collection of binary byte or bits that the computer can read and interpret. Machine language is a coding system built into the hardware of the computer, requiring no translation before being run. Therefore a machine language can also be a machine code.
Machine language consists of 1’s and 0’s. For a program to run, it must be presented to the computer as binary coded machine instructions that are specific to that CPU model or family. Although programmers are sometimes able to modify language in order to fix a running program; they do not create it but rather machine language is created by programmers called assemblers, compliers and interpreters which converts the lines of programming code a human writes into the machine language.
Every processor has its own machine code; therefore machine language differs substantially, i.e. , what may take one instruction in one machine can take 10 instructions in another machine.
A computer is a machine with inbuilt of millions of tiny switches calledtransistor and they can be wired together in such a way that an output from one switch can turn another switch on or off. As a computer computes, these switches turn each other on or off in a pattern determined both by the way they are wired together and by the program that the computer is executing. A computer can work directly with binary numbers because switches can readily represent such numbers: Turn the switch on to represent a one; turn it off to represent a zero. Machine language instructions are stored in memory as patterns of switches turned on or off. When a machine language instruction is loaded into the CPU, all that happens is that certain switches are turned on or off in the pattern that encodes that particular instruction.
Some binary codes used to represent machine language information in a digital computer include:
- Binary Coded Decimal (BCD) code
- American Standard Code for International Interchange (ASCII) code
- Gray code
- External Binary Code Decimal Interchange Code (EBCDIC) code
- Excess-3 code
American Standard Code for International Interchange:
This represents numbers, letters, punctuation, marks and control characters. A standard ASCII is a 7- bit code (127 characters) while an extended ASCII (IBM ASCII) which is also popular is an 8- bit code. An extended ASCII adds graphics and mathematical symbols to code (total of 256 symbols). An example of ASCII is written below.
External Binary Code Decimal Interchange Code:
This is an extension of binary coded decimal (BCD). EBCDIC, is an eight or one byte wide. Each byte consists of two nibbles, each four bits wide. The first four bits define the class of character, while the second nibble defines the specific character inside that class. And recently, it has been to 16 and 32 bit variants to allow for representation of large non- Latin character sets.
If you need assistance with writing your essay, our professional essay writing service is here to help!Essay Writing Service
Factors like dust, electrical disturbance, etc can cause interference in a circuit that is transmitting a byte. The detection of these errors can be accomplished by the use of parity bit, which is also called a check bit. Parity bit is an extra bit attached to the end of a byte for purpose of checking accuracy. Parity schemes may be odd or even.
In computational linguistics, translation is a subfield that makes use of computer software to translate text or speech from one natural language to the other. Translation is the use of software (translator) to translate a high-level language program or an assembly language program into a machine language program.
Types of translators
But we will discuss briefly on compiler and interpreter.
A compiler is a program that translates high-level code into machine code.
How does it work :
It produces object code (translated instructions ready for computer) by translating the source code (high level language instruction). The object code is stored in the machine and can be used repeatedly.
- Source code: This is a computer program which is written by the programmer in some formal programming language.
- Object code: This is the output from the compiler. It is same as machine language translation of the source program. Files from this code always usually have the extension ‘obj’.
- A linker or linkage editor: is a program is a program that pulls other programs together so that they can run. For the fact that most programs are very large and consists of several modules, the linker pulls everything together and makes sure that refrences to other parts of the program (code) are resolved.
Compilers parse the instructions into machine code and store them in a separate file for later execution. Many modern compilers can compile (parse) and execute in memory, giving the ‘appearance’ of an interpreted language.
OUTPUT FROM COMPILATION
Object program generated by compiler is machine independent, therefore programs compiled for one type of machine will not run in another type, which means every type of machine must have its personal compiler for a particular language.
There are many ways errors are being detected in a compiler. Examples are listed below;
If part of the program is mistyped, the compiler may issue a syntax message by listing the tokens which would be acceptable at that point. The message usually displays the type of the error; the line number where the error was detected, the code on that line, and the position of the error within the code.
For example: This error is omitting a semicolon (;) at the end of the statement. Here is the error that will be written;
Testing.java 13: ‘j’ expected. System.out.println (“Input has ” +count+ “chars”.)^ 1 error.
In addition, verifying that your program is syntactically correct, the compiler checks for other basic correctness. For example the compiler warns you each time for use of a variable that has not been initialized: testing.java:13: variable count must have been initialize. count ++ ^ testing. Java:14: variable count may not have been initialized. System.out.println(“Input has” +count+ “chars”); ^ 2 errors. Therefore your program did not successfully compile.
Common errors reported during semantic analysis “identifier not declared”.
Run-time errors such as division by 0 should be detected.
How it is detected:
Some system provide the hexadecimal address of the offending program, while some do tell the name of the routine the error was in and possibly the name and some give the source line.
LANGUAGES USED IN COMPILING:
Below are some few languages that makes use of compiler:
- Newer forms of BASIC(such as visual basic)
- PASCAL, etc.
Like a compiler, it translates a high level language into machine language but it does translates the program at the time of executing the program instruction by instruction. The translated code is not stored permanently in computer memory, hence before execution interpretation becomes necessary. The fact that object code is not stored in the computer, execution of the program becomes slower because of the need for interpretation before each execution. It eliminates the need for a separate compilation after changes to each program. Normally, it is easier to design an interpreter than a compiler.
It takes one statement of higher level languages; translate it into machine language and immediately execute it. Translation and execution are carried out for each statement.
EXAMPLES OF LANGUAGES THAT USE AN INTERPRETER
There are variousprogramming languagesthat use an interpreter but some are listed below. They are as follows:
- Actionscript, etc.
OUTPUTS FROM AN INTERPRETATION PROCESS
The output of an interpretation process is an intermediate code that is later executedinto object program. An example is a bytecode.
HOWAN INTERPRETER REFLECT ERRORS TO USERS
If the interpreter encounters an error while converting a line of code, an error message will be displayed immediately and the interpretation stops. Here, the programmer can correct the error before the interpreter translates the next line of code.
ADVANTAGES OF INTERPRETERS
- Platform Independence: This implies that it is not restricted or confined to any particular computer’s architecture.
- Ease of debugging: It is easier to get source code information in interpreted languages. This facilitates debugging of errors.
- Interpreted programs are flexible.
DISADVANTAGES OF INTERPRETERS
- Interpreted programs do not run fast.
- No object code is produced.
COMPILER VS. INTERPRETER
SO WHICH IS BETTER?
Well, it actually depends on how you want to run your program
CHARACTERISTICS OF COMPILER
- It spends a lot of time analysing and processing the program
- The executable result is in form of a machine specific binary code
- The computer hardware interprets (executes) the resulting code
- Program execution is fast
CHARACTERISTICS OF INTERPRETER
- Little time is spent in analyzing and processing the program
- The resulting code is some sort of intermediate code
- The resulting code is interpreted by another program
- Program execution is slow
Whether using a compiled or interpreted language, you will likely need a text editor in which to enter your instructions. Many compilers come complete with integrated editors optimized for working with the specific language. Using these editors is really not much different from using general text editing tools and word processors, though they may look quite different. One key point here is that so long as you follow the proper format requirements for a given interpreter or compiler, you can use any text editor you chose to construct and edit your source code.
- ….DocumentsDownloadslanguages and os.pps
Cite This Work
To export a reference to this article please select a referencing stye below:
Related ServicesView all
DMCA / Removal Request
If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: