High Level and Low Level Languages

Brett Schules
5 min readOct 12, 2017

--

There are two categories of programming languages, high level and low level. It can be debatable which level goes in which category but the general rule is that it depends on how similar the language is to the only language a computer understands such as machine code (We’ll talk more about machine code later). High level programming languages are ones most developers are familiar with: Java, Ruby, C++, Javascript, etc. A high level programming language is a language that allows you to tell a computer to do something, but in a syntax that is easy and intuitive for you to understand. It is a totally different language from what a computer understands.

Compared to a low level programming language is only a slight abstraction from machine code (if any abstraction at all). It’s much less human readable, yet easier and faster for the computer to understand. It also takes much less memory than a high level language due to less abstractions from machine code compared to high level languages. The most common low level languages are assembly languages. Low level languages work by grouping variations of symbols and letters to represent different aspects of the machine code. They use an assembler to convert the assembly language to machine code. You can think of the assembler as a dictionary. In a dictionary, you can look up a word and find the meaning. Just like a dictionary, an assembler can “look up” assembly codes and return the “meaning” or machine code.

Let’s say machine code is the Mandarin language, and it’s the only language a computer can understand. A high level language is like speaking to the computer in Mandarin, while a low level language is like speaking to it in Pig Latin. It is much easier for the computer to understand low level Pig Latin, which is very similar to English, than it is for it to understand high level Mandarin. Regardless, a computer only understands machine code (or “English”), and needs any language that’s not machine code to be either complied into machine code or interpreted (translated).

Complied vs Interpreted Languages

While low level assembly languages are understood by converting the language to machine code using an assembler, most high level languages are understood by using either a complier or interpreter. We’ll start with interpreted languages first since they have a different process than complied or assembly languages.

Interpreted languages are not converted to machine code. Instead, any program (or source code) written in these languages are directly read line by line by an interpreter. An interpreter is a computer program that executes the actions in the source code in a similar way that a computer can execute machine code. Using an interpreted language allows for faster coding and testing because it can run and give results immediately, unlike compiled languages. What’s also good about these languages is that it can be used on multiple platforms and operating systems since it is not converted to machine code, which is often computer-specific. A disadvantage is that, since it always interprets the code as the code is executed, it can make it much slower than using a compiled language. Python, Perl, and Ruby are popular examples of interpreted languages.

Then there are compiled languages. Compiled languages have to go through a compiler before they are executed. The compiler converts the program into machine code so that it can be understood by the computer. Java, C++, and C# are popular compiled languages. The benefit of compiled languages are that once compiled, they tend to run much faster than interpreted languages. Compiling only has to be done once, then a program can run many times. Interpreted languages on the other hand are consistently being read and can therefore be slower. Another benefit is that, since it is complied, it doesn’t reveal any source code, which means people can’t see or copy your code. A downfall is that they usually don’t work across platforms. A program that runs one way on a Mac doesn’t run the same way on a PC. This is why when you go to download applications on the internet, they have an option to download for Mac OS X or Windows.

From the Complier, to Machine Code, to the Processor

After the compiler (or assembler) converts the high level language to machine code, the computer is ready to execute actions. To understand how the processor of the computer (also known as the Central Processing Unit or CPU) reads machine code, you first need to understand what machine code is.

Machine code is a set of binary instructions consisting of 1’s and 0’s called bits. To the processor, 1 represents an electrical switch being on, while 0 means a switch is off. The 1’s and 0’s are grouped together in different ways, creating 8-bit combinations called bytes. Combinations of these 1’s and 0’s send various electrical signals to the transistors in the CPU. Modern CPU’s have over a billion transistors which contain logic gates. The logic gates are opened and closed based on the bytes of code it receives, and this opening and closing of the gates is what allows your computer to do what you tell it to do.

To wrap this up, there are many different things to consider when choosing a programming language. The advantages of interpreted languages is no compilation means the time from editing code to testing the app can be diminished. However compiled languages are more efficient on time and space due to not having the overhead of an interpreter. Whatever programming language you may choose is up you!

--

--