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:
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.
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.
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.
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.
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.
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.
Below are some few languages that makes use of compiler:
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.
There are variousprogramming languagesthat use an interpreter but some are listed below. They are as follows:
The output of an interpretation process is an intermediate code that is later executedinto object program. An example is a bytecode.
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.
SO WHICH IS BETTER?
Well, it actually depends on how you want to run your program
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.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more