What is a programming language?

The formal definition of programming language is “A programming language is a formal language comprising a set of instructions that produce various kinds of output”. In simple words, as we humans have different languages like Hindi, English, Tamil etc to communicate with each other, what if a human has to communicate with a computer? The language that enables us to communicate with a computer is known as Programming language. All computers speak in binary a series of 1 and 0.

If all the computers speak in binary, then why do we code using English alphabet? The answer to this question introduces two new terms, Compiler and interpreter.

Compiler

A compiler is a tool which is used to convert the text of a programming language (called source code) into machine code. It’s the compiler that converts the High Level Language(HLL) to Low Level Language(LLL). What are HLL and LLL?

High Level Language
A High Level language is a programming language that enables a programmer or user to write programs/codes in a way such that they are easier to read, write and understand. Such languages are considered as HLL because they are closer to Humal Languages and farther from Machine Languages.
Example: C, C++, Java, Python etc.

Low Level Languages
Low level programming language is basically a thing that is close to the hardware you are running your code on. A low level language is a type of programming language that contains basic instructions recognized by a computer. Low level code is often cryptic and not human readable.

Two common types of low level programming languages are Assembly language and Machine language.

Assembly Language
Assembly language is one step closer to high level language than Machine language. It includes commands such as MOV(move), ADD(add), and SUB(subtract). These commands perform basic operations moving values into memory registers and performing calculations. Assembly language can be converted into Machine language using Assembler.

It’s very hard to understand as low level languages are not human readable.

Machine language
Machine language or machine code is the lowest level of computer languages. It contains binary code, often generated by compiling high-level source code for a specific processor. Most developers never need to edit or even look at macine code. Only programmers who build software compilers and operating systems need to view machine code.
The basic Hello World program in machine language will be more worst than that of assembly language.

So what does the compiler go through to convert HLL to LLL? There are 6 phases in a compiler. Each of this phase help in converting the high-level programming language to machine code.

High level language -> lexical analyzer -> syntax analyzer -> intermediate code generator -> code optimiser -> code generator -> Machine code

These are all the 6 phases that a compiler go through to convert high level language to a machine code.

Interpreter
Interpreter is a tool that executes instructions written in high level language. This simply means that an interpreter directly executes a HLL code without converting it into machine code. The compiled programs usually run faster and give precised results than interpreted programs.

Hope this article provides you some basic information about programming languages.
         

Categories: News