Natural languages vs Programming languagesFundamentals


By Maduranga Jayasinghe | 2017, September 13  Views : 338












මෙම පිටුව යාවත්කාලීන කරමින් පවතී...











What is a language?


Let's consider for a moment what language itself is. I'll try not to resort to scientific definitions and explaining simply, we can say that a language is a method of expressing and recording human thoughts. In other words, the method of human communication, either spoken or written, consisting of the use of words in a structured and conventional way. Language can be used for speaking, writing, reading, listening, thinking and many other purposes.


What is native language?


At least one language accompanies every human beings whole over the world throughout their whole lives - it's their native language, their mother tongue. We'll learn other languages, mostly as a result of conscious decision, perhaps forced by social condition, career needs, or perhaps simply out of personal interest. These languages we use to communicate with other people are call natural languages. They were created over many centuries and still are subject to change.


What is the programming languages?


However, there are languages whose creation were continue to be dictated by specific needs and development is subject to control by group of people, such as international organizations or committees. These kind of languages are defined by international standards. Even though these languages are understood by many people, expressing and recording human thoughts is not the main application. Such a languages are programming languages.


Lexicon, Syntax and Semantics


You may familiar with programming language concept already. A programming language uses a set of rigid rules and not much more flexible like any other natural languages. For an instance, programing language rules determine symbols (digit, letters, punctuation marks, etc..) what can be used in the language. These definition is called lexicon. Besides, another set of rules determines the proper way of combination of symbols. This is called the syntax of the programing language. Recognition the meaning of every statement in the programming language called semantics. All the program you write must be correct in lexically, syntactically and semantically. Otherwise it will never compile, run or not given expectable results.

The expressive power of programming languages is weaker than natural languages. You cannot use a programing language to express human emotions. It's a simple fact that the information embedded inside a computer program is not intended for a human, but for a machine.


Why need a programming language?


A computer, even the most technically sophisticated one, responds only to a predetermined set of known commands. These recognized commands are very simple. In other word, Imagine that the computer responds to orders like "Take that number, Take this number, add both number and save". A complete set of well-known commands is called an instruction list (IL). Different types of computer use different types of commands. Hence computer may vary depending on the size of their instruction lists.

The IL is the alphabet of a language, generally known as a machine language. This is the most primary language we can use to give commands to the computer. It's the computer's mother tongue.

Computer programming is the art of composing instructions in order to perform a desired output from the computer. For instance, suppose that there are two programmers write two computer program separately to get same output. The instructions they have used is might be completely different in each program. It's up to the programmer's imagination, knowledge, experience to determine what that effect should be.

Even though it is tedious, time consuming and highly prone to a programmer's mistakes, It is possible and often used in practice, for a computer program to be coded directly in machine language using instructions. At the early stage of computer technology, this was the only available method of computer programming. Programming in machine language requires exhaustive knowledge of the computer hardware design and its internal structure. Not only that, old programs cannot run and completely useless if the new computer uses a different instruction list. Programs written in machine language are very difficult for humans to understand, including experience programmers. It takes a long time to develop programs in machine language, and it's costly effected to all the development life cycle.


High-level programming languages


All these circumstance persuade computer engineers to develop some kind of bridge between the human natural language and the computer language (machine language). This bridge is also a language what an intermediate common language for humans and computer to works together. This kind of languages are called high-level programming languages.

A high-level programming language is somewhat similar to a natural language. It uses words, symbols and conventions readable to humans. High-level languages support humans to express complex commands for computers.


Compiler


Using high-level programing language, how we can make computers understand program written in easy way? You have to translate your program into machine language. This translation can be done by a computer using particular computer program called compiler, and The translating process from high-level language into machine language is called compilation.

There are many benefits you can get using high-level programming languages.


  1. Don't need to learn many different machine languages.
  2. Compiler take the responsibility to translate high-level language to machine language.

  3. Just need to know one high-level programming language.
  4. You can use same program and can be converted into machine language using specific translator (compiler) designed for specific computer. In other words, the programs written in high-level languages could be translated into any number of different machine languages. Thus make them usable on many different computers. This feature of high-level programing languages is called portability.


code portability

Suppose that you have written a program using one of latest high-level programing language using popular text editor. Then you cannot run this written program and you have to compile this code. To do this you run a particular compiler. Instructing it where you store the source code that you want to translate into machine language.


Compile process


First, compiler reads your code, does some complex analysis and its first goal is to determine whether or not you have made any errors during the coding. This analysis process is very insightful but remember that it's done by computer not a human. You shouldn't expect too much things from it. If you have made any mistake, compiler will inform error messages to you with as much as information that it has captured.

If the compiler doesn't notice any mistakes in your source, it means your program has translated into machine language properly. This file is called executable file. Type of the file ( program file, library file etc..), extension of the file depends on the target computer you use and the operating system you're working with.

Now, Let's look at the whole process which is actually a bit more complicated. Suppose that your source code is divided among several source files. This may also happen that the program was not written by you alone, but by a team. In this case the division of sources into multiple files is a must. In such a case, the compiling splits into two phases.


  1. Compilation of source code
  2. Translate each and every source file into machine language separately. This will generate separate files.

  3. Joining or gluing
  4. Finally, Joining of multiple executable code into single and unified file. Joining different executable codes is commonly called linking which conducts the process is called linker.




I think that you could get the basic understanding of the different between the natural language and the computer language. If you have any question, Don't forget to put a comment.











このページを更新中です!!!