Machine language

        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:

  1. Binary Coded Decimal (BCD) code
  2. American Standard Code for International Interchange (ASCII) code
  3. Gray code
  4. External Binary Code Decimal Interchange Code (EBCDIC) code
  5. 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.

Read also  The Benefits Of Blackberry Information Technology Essay

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.

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.

TRANSLATION

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

  • Assembler
  • Interpreter
  • Compiler

But we will discuss briefly on compiler and interpreter.

COMPILER

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.

DIAGRAMATICALLY:

  • 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.

Read also  Analysis of the communication process in KFC

COMPILER ERRORS:

There are many ways errors are being detected in a compiler. Examples are listed below;

SYNTAX ERROR:

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.

SEMANTIC 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 ERROR:

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)
  • C/C++
  • DELPHI
  • COBOL
  • FORTRAN
  • PASCAL, etc.

INTERPRETER

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.

DIAGRAMATICALLY:

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.

Read also  The Introduction To Ecommerce Information Technology Essay

EXAMPLES OF LANGUAGES THAT USE AN INTERPRETER

There are variousprogramming languagesthat use an interpreter but some are listed below. They are as follows:

  • LISP
  • Prolog
  • JavaScript
  • MUMPS
  • Forth
  • 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

N/B:

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.

REFRENCES :

1a)

  • http://www.answers.com/topic/machine-language
  • http://dictionary.reference.com/browse/machine+language
  • http://www.answers.com/topic/reduced-instruction-set-computer
  • http://www.computerhope.com/jargon/m/machlang.htmto
  • http://74.125.153.132/search?q=cache:xQcAp7fSBtUJ:www.cs.huji.ac.il/course/2002/nand2tet/docs/ch_4_machine_language.pdf+machine+language+example&cd=8&hl=en&ct=clnk&gl=sg
  • http://www.economicexpert.com/a/Machine:language.htm
  • http://www.google.com.sg/search?hl=en&q=machine+language+example&meta=&aq=0&oq=machine+language+exa
  • http://onlinedictionary.datasegment.com/word/machine+language
  • http://math.hws.edu/javanotes/c1/s1.html
  • http://74.125.153.132/search?q=cache:-pKEkL1OAvsJ:www.sxccal.edu/stmat/ug_comsc/languages%2520and%2520os.pps+examples+of+machine+codes+in+ascii&cd=12&hl=en&ct=clnk&gl=sg
  • http://www.yourdictionary.com/computer/gray-code
  • http://www.wisegeek.com/what-is-ebcdic.htm
  • http://www.answerbag.com/q_view/375603
  • http://74.125.153.132/search?q=cache:MzfuuNCnsmoJ:ocw.kfupm.edu.sa/user%255CDADICS102%255CLectureSlides/L02_OverviewOfProgrammingLanguages.ppt+advantages+and+disadvantages+of+machine+language&cd=7&hl=en&ct=clnk&gl=sg
  • http://www.nos.org/htm/funda3.htm
  • http://74.125.153.132/search?q=cache:oqCIojvxA74J:classes.seattleu.edu/computer_science/csse103/froude/Student_Data_Files/word/WD0910.doc+parity+bit+in+machine+language&cd=10&hl=en&ct=clnk&gl=sg

1b)

  • http://www.answers.com/topic/machine-translation
  • http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.pli.doc/ibmx2mst127.htm
  • ….DocumentsDownloadslanguages and os.pps
  • http://java.sun.com/docs/books/tutorial/getStarted/problems/
  • http://web.cs.wpi.edu/~gpollice/cs544-f05/CourseNotes/maps/Class1/Structureofacompiler.html
  • http://web.cs.wpi.edu/~gpollice/cs544-f05/CourseNotes/maps/Class1/Compilervs.Interpreter.html
Order Now

Order Now

Type of Paper
Subject
Deadline
Number of Pages
(275 words)