Two types of programming languages: compiled and interpreted - PROGRAMMING FOR BEGINNERS: All Concepts Explained (2016)

PROGRAMMING FOR BEGINNERS: All Concepts Explained (2016)

3. Two types of programming languages: compiled and interpreted

Programming languages are divided in two categories: compiled and interpreted programming languages. Both categories have advantages and disadvantages, and each category is recommended for writing specific kind of software.

3.1 Compiled programming languages

Compiled programming language is a programming language which's source code is compiled into machine language code by the process called compilation. During compilation, a program called compiler converts source code written in high level language into machine language code which can be directly executed by the CPU.

The advantage of compiled programming language is that programs written in compiled programming languages work fast and does not need interpreter software to be installed on the computer on which they run. For these reasons, programs which need to be executed expeditiously such as games and system softwares are written in compiled programming languages.

The negative side of compiled programming language is that compiled programs will only work on particular CPU and operating system. For example, source code compiled for Windows OS (Operating System – system software that controls main operations of computer. Application softwares are written and run on specific Operating Systems. Microsoft Windows, Mac OS and Linux are examples of Operating Systems) will not work on Mac and Linux operating systems.

3.2 Interpreted programming languages

Interpreted programming languages run using a special program called interpreter (also known as Virtual Machine or VM for short). Interpreter reads code written in interpreted programming language and interprets code instructions to machine code at runtime. Interpreter interprets each code instruction to machine language one at a time, whereas compiler translates all code instructions to machine language. Obviously interpreting code instructions at runtime needs some processing power, so programs written in interpreted programming languages run slower compared to programs written in compiled programming languages.

Interpreted programming languages are used to write applications where fast execution of program is not critical and program portability has priority.

The advantage of interpreted programming language is that programs written in it can run on any computer if they have interpreter installed. It is not needed to modify source code of application written in interpreted programming language, it can be run on any computer which has interpreter application, whereas programs written in compiled programming languages might require many modifications of source code and separate compilations for each computer systems they are desired to run.

What is programming language, really? And how to create new programming language

Probably you have understood what is programming language generally from the section "What is programming language?" of this book, but what it is really, technically? technically, every syntax rules and keywords (syntax rules and keywords are the only building blocks of programming language) of programming language are contained in programming language compiler or interpreter, so these softwares (compiler and/or interpreter) define complete programming language. Because both compilers and interpreters are just programs written in specific programming languages, you can create compilers and interpreters but this can be highly technical programming task because compilers and interpreters need to convert source code into machine language, which is highly technical task and you need to have deep understanding of hardware and computer logic. Compilers and interpreters are created (you can create new programming language this way) using low level programming languages. such as assembly languages and sometimes with C programming language.