What is a programming language?

  1. Courses


  2. Complete C++ Course


  3. Introduction


  4. What is a programming language

Text vs binary code

We understand text that is composed of words according to a set of rules dictated by the english language. Computers understand binary code (Specific to the architecture of the processor). We could directly code in binary but… We would not like that. We can not directly tell the computer what to do, in english, because it would not like that either. Well, we have to compromise. What we have to do is tell the computer what to do by following a syntax defined by a programming language (like C and C++) and a program called compiler will do the hard work and translate it into binary code that the computer will happily understand. Aside from being way (wayyyy) easier to write than binary code, a program written in a programming language can most of the time be executed on processors of different architectures by using different compilers.

A programming language is similar to a human language. It is basically a set of words and rules that tells you how to communicate. It this case what you want to communicate with is the computer. Well, actually, we only directly communicate with the compiler. The compiler acts as a translator between us and the computer.

Coding directly in the language the computer understands

There is a language called assembly that is very (very) close to binary code. In assembly, we basically tell the processor what to do, instruction by instruction, using words instead of binary and a program called assembler translates it to binary. As different processors have different instruction sets, assembly language is relative to the architecture of the computer. In assembly, we almost have absolute control over what the program does, but coding the equivalent of a program coded in a language like C requires way more work.

I said that code written in C and C++ was translated into binary code by a compiler. That is true, but there is a step between that. C and C++ codes are actually translated into assembly by the compiler and then assembled, by an assembler, into binary code. It is actually possible to directly include assembly language code into C or C++ code. Knowing assembly is very useful to better understand how languages like C and C++ works, but assembly is very rarely used alone.

Learning to code in assembly is a good idea, but it is best to learn a low-level (But higher-level than assembly) language like C or C++ before that. A low-level language is a language that is close (in its syntax) to what the computer actually understand. That means that what we code is close to what is actually executed on the processor. A high-level language is the opposite.