Introduction to Programming Languages
A program is a set of instructions that tells a computer what to do in order to come up with a solution to a particular problem. Programs are written using a programming language. A programming language is a formal language designed to communicate instructions to a computer. There are two major types of programming languages: low-level languages and high-level languages.
Low-level languages are referred to as ‘low’ because they are very close to how different hardware elements of a computer actually communicate with each other. Low-level languages are machine oriented and require extensive knowledge of computer hardware and its configuration. There are two categories of low-level languages: machine language and assembly language.
Machine language, or machine code, is the only language that is directly understood by the computer, and it does not need to be translated. All instructions use binary notation and are written as a string of 1s and 0s. A program instruction in machine language may look something like this:
However, binary notation is very difficult for humans to understand. This is where assembly languages come in.
An assembly language is the first step to improve programming structure and make machine language more readable by humans. An assembly language consists of a set of symbols and letters. A translator is required to translate the assembly language to machine language called the ‘assembler.’
While easier than machine code, assembly languages are still pretty difficult to understand. This is why high-level languages have been developed.
A high-level language is a programming language that uses English and mathematical symbols, like +, -, % and many others, in its instructions. When using the term ‘programming languages,’ most people are actually referring to high-level languages. High-level languages are the languages most often used by programmers to write programs. Examples of high-Level languages are C++, Fortran, Java and Python.
Learning a high-level language is not unlike learning another human language – you need to learn vocabulary and grammar so you can make sentences. To learn a programming language, you need to learn commands, syntax and logic, which correspond closely to vocabulary and grammar. The code of most high-level languages is portable and the same code can run on different hardware without modification. Both machine code and assembly languages are hardware 10101011100001110100111101 specific which means that the machine code used to run a program on one specific computer needs to be modified to run on another computer.
A high-level language cannot be understood directly by a computer, and it needs to be translated into machine code. There are two ways to do this, and they are related to how the program is executed: a high-level language can be compiled or interpreted.