What makes a language to be considered low/high level?

Asked

Viewed 20,263 times

108

What makes a language to be considered high-level and other low-level?

  • 10

    Assembly is too high-level compared to binary code. p

  • 3

    I don’t think so. The Assembler (assembler) will basically only replace words in Assembly (language) with memory addresses and binary codes. This makes Assembly just another more readable way, a way of seeing binary numbers in a language understandable to humans.

13 answers

108


The "level" in this context can be understood as the level of detail of the algorithm for it to perform a given task.

Making an analogy, consider that you pronounced the following sentence to a classmate of yours:

(Please,) take my rubber that fell to the ground.

Let’s assume for now that this can be regarded as a high-level command. You didn’t have to type it anywhere, if you make a Portuguese mistake in it you still have a chance to be understood correctly by the receiver, anyway, you didn’t have to give too many details to perform a relatively complex task (you will understand why I am saying that the task is complex by looking down).

If instead of your colleague, you tell this to your computer, rest assured, nothing he will do. When you passed the command to a person, she translated that single phrase into numerous super detailed commands that are related to extending and flexing your numerous muscles, balancing your body, breath, among countless other things you do not need to speak to her because these details of her body’s functioning do not need to be passed on at her command for the person to perform. For example, no one will stop breathing when lowering to pick up a rubber and claim:

You didn’t make it clear that I should keep breathing while I picked up the rubber, so I thought I should stop breathing while I didn’t finish the task you gave me.

Supposing now that you built a robot that has an anatomy that resembles that of a human being, but it doesn’t have the brain of a human being, and that it has the ability to understand the words that you pronounce and respond to them through actions, however the amount of words he is able to understand are very limited as well as the actions he is able to perform. Suppose the actions that he can perform are things like, "raise your arm," "lower your arm," "walk 5 meters," and things like that, imagine that now a person wants to talk to that robot to bend down to pick up a rubber that fell to the ground, the robot doesn’t know what "rubber" isYou don’t know what "fall" is either. Therefore, one cannot expect to pass to the robot the same command that was passed to the human being and expect him to complete the task just as the human was able, in that case the commands should be a much higher level of detail, as for example:

* Gire seu corpo 14° para a esquerda;  
* Ande por 112mm;  
* Incline seu corpo 60° para a frente;  
* Dobre o seu joelho em 15º;  
* Estenda seu braço deixando-o perpendicular ao plano;  
* Feche a ponta dos dedos até que se faça contato com um objeto;
* Volte o seu tronco para a posição vertical;  
* Desdobre seu joelho;  
* Gire o seu corpo 90° para a direita;  
* Ande por 40mm;  
* Abra a mão.

And you run the risk of getting some number of this entire algorithm wrong that will cause your robot to pick up your colleague’s foot instead of picking up the rubber, or that it falls to the ground when you bend your knee because you didn’t calculate right the angle that should have been passed to him.

Therefore, comparatively, the language used with the human being was of much higher level than the language used with the robot, because it was not necessary to pass numerous details of the implementation for it to complete the task. This does not mean that the language used with the robot is low-level, she’s just from plus low level than the language used with the human being. So it’s hard to say what a low-level, high-level language is because it depends on the parameters that are used at that time, whether the parameters change the high-level and low-level classification also changes.

Machine code can be considered very low level, this is clear if you do not consider writing code with a magnetized needle changing bits on your hard drive ;)

And Java can be considered high level, until you stop to think that high level is actually the command that the client passed to the programmer:

I want a system that does this, this and that.

And this might not yet be considered as high-level, if there was the possibility of the programmer knowing what the client needs to just look at it (dream :P).

And how the academic world defines the "level"?

Instead of just telling the story of a robot that looked like a person, I decided to collect some fragments of books, articles, among others, to compare with what I said and check if it is in agreement with what these authors claim in their works. What I found during my research was that when trying to give a classification of the "level" of a language the authors ended up being too superficial or even contradictory. Let’s see below.

In the preface to the first edition of the 1978 book Kernighan, Brian W., and Dennis M. Ritchie. The C Programming language. Vol. 2. Englewood Cliffs: Presentice-Hall, 1988., has the following text::

C is a general-purpose Programming language with Features Economy of Expression, Modern flow control and data Structures, and a rich set of Operators. C is not a "very high level" language, nor a "big" one, and is not Specialized to any particular area of application. [...]

In free translation:

C is a general-purpose programming language featuring expression economy, modern flow control and data structures, and a rich set of operators. C is not a "very high level language", or "large", and does not specialise in any particular area of application. [...]

By stating that it is not "very high level" I draw the conclusion that it is high level, but not very... however much the author considers "too much" for this case. It’s at least a vague definition, but let’s continue.

Still in the same book, in the introduction, 3 pages later, the author says:

C is a relatively "low-level" language. This characterization is not pejorative; it Simply Means that C Deals with the same Sort of Objects that Most Computers do. [...]

In free translation:

C is relatively a "low-level language". This characterization is not pejorative; it simply means that C handles the same types of objects as most computers. [...]

I don’t know about you, but I was confused, because now the language was given as "low level".

It is worth noting that the author of this book is none other than Dennis Ritchie, the creator of the language C. The book in question is famous for having given life to the language C, because until its release the language was not very widespread, It was the largest watershed in the history of the language C. Entrentato, but it was not possible to find in it an objective answer on the level of the language C.

Another book that had a great importance in the history of C, Koenig, Andrew. C traps and pitfalls. AT and T Bell Laboratories. Computing Science, 1986. we can find in the references of the book:

The C Programming Language (Kernighan and Ritchie, Prentice-Hall 1978) is the definitive work on C. It contains Both an Excellent tutorial, aimed at people who are already familiar with other high-level Languages, and a Reference manual that describes the entire language succinctly. While the language has Expanded Slightly Since 1978, this book is still the last word on Most subjects. [...]

In free translation:

The book C Programming Language (Kernighan and Ritchie, Prentice-Hall 1978) is the definitive work in C. It contains both an excellent tutorial, intended for those people who are already familiar with other high-level languages, and a reference manual describing the entire language succinctly. While language has expanded since 1978, this book is still the last word on most subjects. [...]

Once again the C language has been defined as being high-level.

Not too complicated yet? How about then we take a look at the text of part of a master’s dissertation from the Federal University of Rio Grande do Sul :

For being a high-level language, the algorithm in C becomes more complex than the same algorithm done in PHP (high level), for example. On the other hand, the programmer has a much larger number of resources and can more safely control the operations he needs to process.

Which gives a new classification for the C that until now we had not seen: Medium level :-/

Wikipedia in turn states something clearly and that the above quotes only lead to believe that it is covered by reason, when describing the relative significance of the level of programming languages :

The Terms high-level and low-level are inherently relative. Some decades ago, the C language, and similar Languages, Were Most often considered "high-level", as it supported Concepts such as Expression Evaluation, parameterised recursive functions, and data types and Structures, while Assembly language was considered "low-level". Today, Many programmers Might refer to C as low-level, as it Lacks a large Runtime-system (in Garbage Collection, etc.), Basically Supports only scalar Operations, and provides direct memory Addressing. It, therefore, Readily blends with Assembly language and the machine level of Cpus and microcontrollers.

Assembly language may itself be regarded as a Higher level (but often still one-to-one if used without macros) representation of machine code, as it Supports Concepts such as constants and (Limited) Expressions, sometimes Even variables, procedures, and data Structures. Machine code, in its turn, is inherently at a Slightly Higher level than the microcode or micro-Operations used internally in Many Processors.

In free translation:

The terms high and low level are inherently relative. A few decades ago, the C language, and similar languages, were often considered "high-level", as they supported concepts such as expression analysis, parameterized recursive functions, data types, and structures, while Assembly was considered "low-level". Today, many programmers may refer to C as a low-level language, as it lacks a large system of Runtime (without Garbage Collection, etc.), basically supports only scalar operations, and provides direct access to memory addressing. This, of course, readily combines with the Assembly language and machine level of Cpus and micro controllers.

The Assembly language itself can be considered high-level (but usually still-one if used without macros) machine code representation languages, because it supports concepts such as constants and expressions (limited), sometimes even variables, procedure, and data structure. Machine code, in turn, is inherently slightly higher than the micro code or micro operations used internally in many processors.

In search of a clear and succinct definition of what is high and low level, and on what level the C language fits, this is what I found.

To me, these excerpts above just make clear what has already been said in the responses and comments (not only by myself) here on this topic: The classification of the level of a given language changes as new needs arise and new technologies as well, then it is impossible to determine definitively what is the level of a language, we can only say that the level is higher or lower when comparing with a certain parameter.

Note: The links of the books were taken from Google Scholar, whose Terms if Service make it clear that they respect copyright and undertake to publish what they have permission to.

  • 7

    Credits of the magnetized needle for the Onosendai who sent the following comic in chat these days: http://chat.stackexchange.com/transcript/message/20700984#20700984 Lower than the magnetized needle only the butterflies of the comic :)

  • 3

    Excellent answer. + 1 for teaching and relaxation. : D

  • 1

    @Math - Dammit, Emacs. ;)

  • in short: low level (next to machine language), high level (next to human language)

53

A picture is worth a thousand words

Baixo e alto nível

Computational abstraction

Thinking about an approach to differentiate high and low level languages from the point of view of who is programming, the language level is proportional to how much you spend thinking about solving your problem (high level) or solving problems related to computational calculations (low level).

For example, consider the following "commands":

  1. Move text "ABC" to memory position 123, copy all characters to the open stream pointing to disk position 456.
  2. Save "ABC" text to "doc.txt"
  3. Update the client name with the value "João"

Item #1 is certainly the lowest level. Compared to it, item #2 is the highest level.

However, we have item #3, which is higher level than all. Compared to it, item #2 is lower level.

Amount of abstraction layers

Since computers have emerged there is an effort to make your programming easier. This has been done by creating new languages and more advanced compilers, as well as through macros, methods or objects that abstract and automate certain tasks.

However, each time we add one of these "facilities", we increase the amount of abstraction or indirect layers in relation to binary computation.

For example:

  1. Assembly is a language that maps almost directly to machine code, but still the program is written in text before it is converted into binary. In general, each Assembly command consists of an instruction to the processor.
  2. C is a higher level language, where each command is translated by the compiler usually into several assembly instructions (albeit in memory) before actually generating binary code.
  3. Java and .NET are even higher level languages because each command generates one or more virtual machine instructions, which is not the same as machine language. Each instruction of these virtual machines needs to be translated, at runtime, to a set of machine instructions corresponding to the CPU architecture where the program is running.
  4. In the PHP, as interpreted language, each command is processed by code previously compiled in C, usually leading to the execution of several code snippets equivalent to several C functions that are mapped to numerous machine instructions.

It is worth noting that, in general, the amount of abstraction levels is proportional to how far the programmer is "away" from the hardware, but this is not always directly proportional.

Level up

Language independent, programmers should program at a high level whenever possible.

Even if your development platform allows you to chat directly with hardware, in order to maintain sanity, a good programmer will abstract all this complexity into higher-level routines according to the language’s capabilities (functions, method, objects, modules, etc.).

Imagine the following code:

notaFiscal = ler_arquivo_nota_fiscal(caminho);
validar_nota_fiscal(notaFiscal);
salvar_nova_fiscal(notaFiscal);

Except for the encoding style, be it Java or Javascript, C or C#, Shellscript or PHP, anyone can understand what the above code does and implement the details in the respective routines.

After all, it’s not because someone in C who necessarily needs to be always coding at a low level.

Considerations

It is not possible to state absolutely that a given language is of high or low level.

What we could say is that all programming languages are of higher level than binary code (provided it is humanly possible to read the code, obviously).

Furthermore, we could also say that a language X is of higher or lower level compared to some other language Y considering the aspect Z.

Finally, within the same language, it is possible to program at different levels of abstraction. Good programmers will rise to the level whenever possible both to increase productivity and to improve code quality.

  • Yes, perhaps in the old days when C was created it should be considered without doubt high-level in relation to Assembly

  • How can I do a macro in Assembly to express something like in the first form so an Assembly that accepts macros can be considered high level?

  • @bigown A macro is a higher-level abstraction of a lower-level instruction set. When you think about it, a C compiler, for example, doesn’t do the same thing basically if you think of each command of a high-level language as a macro?

  • @bigown In my opinion there are several Assembly languages at different levels but still very close. However considering the spectrum of all languages remains low.

  • This is precisely the question. It is not possible to define very well what is high and what is low level. Every time someone tries to take an aspect and say that it defines whether it is high level or not, a way of analyzing the same thing shows the opposite. That’s why everyone finds something about C.

  • @bigown I agree. My initial response was just a mental sketch. I gave an improved one now to make that point clear.

  • Another important point was made, a language can have an absurd abstraction and not be readable, so what? This definition is complicated and I think that because of this no one risked digging into it or if someone did, they were not taken seriously. I think the question served more to clarify this difficulty of classification and to give a general parameter of evaluation.

  • 1

    +1 per image only :)

Show 3 more comments

42

I have seen several definitions but I do not know one that is universally accepted as correct and accurate. There are some people with opinions on the subject.

Generally speaking, it can be said that high-level languages are those that provide the highest level of abstraction and low-level languages are those that provide the lowest level, so they are more concrete.

Another way to explain it is to say that the high-level languages are those that are closest to human understanding and the low-level languages are closer to the concrete operation of the machine.

High-level languages are more expressive, that is, you say better what the intention of the algorithm is. The others say more what to do without worrying to make clear what the intention is.

Certainly the lack of syntax with better constructions to express intuitively what you want to do, in a structured way makes it a lower level language. These languages cannot define the problem as it really is. They care a lot about the mechanism to solve the problem and less about the concept of it.

It is also certain that there is more control than the machine should perform in low-level languages.

So the classification would be by the distance she has from the hardware work. In general, high-level languages hinder or even prohibit direct access to hardware, which is the opposite of what low-level languages do. But it’s not just access that counts, it’s how this access is done. High-level languages do not require in-depth knowledge of the functioning of hardware.

I do not know if it is possible to give a more specific definition than this without getting into controversy. Even worse is trying to classify languages. There the controversy is greater for lack of a formal definition. It is not easy to draw a line and say this is high or low level. You can make a relation of greatness, indicate that one language is higher than another. Of course everyone agrees that machine language is low level and language script is high level. There are so many controversies, so much so that they have created the middle level and the very high level to classify some languages. What level is C? I have heard at least three levels and if I say I agree with one of them it will only be my opinion. Unless someone shows me some reliable, validated study that makes it clear and uncontested how to classify a language. It’s possible to do this, I just don’t think it has a formal acceptable definition.

Some people often say that high-level languages are easier to learn and use. I don’t entirely agree with this. Learning is usually more difficult, at least for me. To use depends on the problem being solved. That’s why I can’t find a good way to classify.

They also say about the independence of execution on any machine as characteristic of high-level languages. But I don’t think this applies in 100% of cases.

The speed of execution also seems to be a side effect only.

Wikipedia has extensive definitions of what is high level and of low level. I don’t see these definitions being accepted by everyone.

But I find it worse when they try to classify languages by generations. The application of the concept is already wrong.

I like the definition of Alan Perlis in his famous epigrams of programming, chiefly:

A programming language is low-level when its programs require attention to irrelevant aspects (to the domain)

  • 7

    What is wrong with the question to receive -1. There are days when I am chosen to receive negatives.

  • only one detail "What is wrong with the QUESTION to receive -1" ???? Nothing Ué...srsrsr takes +1 since I liked the comment

29

Low-level language works more directly with hardware, it is a language closer to machine language. Assembly is an example of low-level language.

A high-level language, on the other hand, allows you to work without having to define more hardware-related issues. It is closer to human language. An example of high-level language is Java.

High-level languages tend to be faster to program, but have a lower runtime performance. Low-level languages tend to require more expensive work, however they allow the creation of lighter and faster programs.

25

My opinion is that it has to do with how language resources are made. The lowest level faithfully passes on the machine’s resources (even if it is a virtual machine). While the highest level aggregate resources based on other more fundamental resources.

For example:

  • if/else and while are higher than a if + goto;
  • if + goto is higher than cmp, jnz, je, jle, jz, jmp (instructions Assembly);
  • jle (an Assembly instruction) is higher level than 7E xx (JLE short), 0F 8E xx xx (JLE near 32 bits mode), 0F 8E xx xx xx xx (JLE near 64 bits mode). Note that the Assembly JLE can be compiled for 3 machine instructions, depending on the operand, and the operating mode of the processor (32-bit or 64-bit).

As one resource is made from the other, the level goes up, as if it were a ladder. I think that’s where the analogy of low and high levels came from.

I know I was very opinionated, so if anyone thinks you missed objectivity tell me, that I try to improve.

  • if I had read your answer first, nor would I have written my rsr, p/me is that right there.

  • That this friend... is no problem. This answer is kind of hard to see even, after all I am surrounded by Itans here at SOPT. = D

20

A low-level language is one that does not require an interpreter to convert machine language code (e.g. C / Assembly)

A High Level language is all the language, not compiled that requires an interpreter or interpreter in order to be converted into machine language in order to be understood and executed by hardware (Ex. Processor / Memory).

We can then say that the major differences between High Level and Low Level Languages are as follows::

High level languages ( Python, Java )

  • Provide automatic memory management where the programmer has no control over how memory is allocated and retrieved.

  • Collection of the "trash" generated by automatic interpreter management, requires physical storage.

Low level languages ( C , Assembly )

  • The workflow of processes is managed by the code developed, giving the programmer total freedom to manage the available resources of the hardware.

  • all memory resources are managed by the programmer and the developed program.

More information, see:

  • 1

    Although accepted as an answer, the definition is completely mistaken. There are only two low-level languages: assembly and machine code. Whoever programs in Assembly knows that an Assembly instruction is equivalent to an instruction in machine code, which is why it is considered low-level. On the other hand, high-level languages like C do not have this 1-by-1 ratio like Assembly. A whole structure beneath the C code is generated by the compiler, inserting many machine instructions for a single instruction made by the programmer. (Just to warn the "Googlers")

15

What makes a language low/high level is their level of abstraction, the closer to the hardware (even to the point where knowledge about the hardware will be implemented and installed) the lower level it will be (less readability to the bridge to use mnemonics and productivity since you will have to write several small instructions (naturally they are more granularized) to get a certain result) and the higher the level the closer it tends to look like natural language, allow algorithms to be expressed at a level and easy writing style for reading and understanding, have portability characteristics since they can be transferred from one machine to another. below a rudimentary explanatory image:

inserir a descrição da imagem aqui

Some examples of language for each type of language:

Machine and Assembly language: Languages that depend on machine architecture (Assembly language is a symbolic representation of the associated machine language).

Languages of Medium Level: Although many do not accept this term, C is classified as a medium-level language because it can, for example, access system records or work with memory addresses, which are features of low-level languages, and at the same time perform high-level operations.

High Level Languages: Java, PHP, C# and many others.

Declarative languages (Expressive languages such as oral language express what to do instead of how to do it, can contain: functional programming, logic programming or restrictive programming): Haskell (functional) and Prolog(logic).

An addendum: Languages can be divided into generations as well:

  • First Generation: Machine Language.
  • Second generation: The first Assembler languages were created.
  • Third generation: The first high-level languages are created. Ex: C*, Pascal, Cobol...
  • Fourth generation: Languages capable of generating code by themselves, are the so-called RAD, with which one can realize applications without be an expert in language. Here are also languages object-oriented, making it possible to reuse parts of the
    code for other programs. Ex: Visual, Natural Adabes...
  • Fifth generation: Here are the languages oriented to artificial intelligence. These languages are still little developed. Ex: LISP

Another addendum to the question (slightly outside the scope): There are high-level language frameworks that like Rails and Grails that greatly increase the productivity of the developer.

14

High level programming language is what is called, in computer science of programming languages, a language with a relatively high level of abstraction, away from machine code and closer to human language. Thus, high-level languages are not directly related to computer architecture. The programmer of a high-level language does not need to know processor features such as instructions and registers.

Low level programming language It is a programming language that understands the characteristics of the computer architecture. Thus, it uses only processor instructions, for this it is necessary to know the machine registers. In this sense, low-level languages are directly related to computer architecture. An example is the Assembly (non-assembler) language that works directly with the processor’s registers, manipulating data

12

I will be short not to lengthen like the others, the code you wrote is to directly manipulate the hardware? ex: driver programming of a particular equipment, then you will use a low-level language, the level is low so it is close to the hardware.

If you have written a source code, which you do not know where some things come from ex: the window/screen of the system you have encoded is already ready - or you have used API, or plugin, already have a lot of code by "down" than you have programmed, then you are programming at a high level.

11

Simplifying...

High Level: Further away from machine language.

Low Level: Closest to machine language.

Machine language = Torque... Zero (0) and Um (1) = 11001100011

Logo: The lower level you program, the more complicated the process and the higher level is easier.

Observing: Have you ever heard of English? It is a language in Portuguese, used to learn programming logic. It is considered a high level language, as it is easy to interpret the codes.

4

I believe that the polemics and disagreements are due to the term used "low level" and "high level". I think a more appropriate term could be "low layer" and "high layer" i.e., "low layer" and "high layer". But finally, from what I’ve always understood, low-level languages are those that deal directly with hardware. An example is Assembly (Assembler).

There is some confusion also about "what is to communicate directly with hardware" as many devices and hardware components now offer communication Apis, through which high-level languages can communicate with hardware. In these cases there is no direct communication with the hardware because who does this is the compiler of the internal language of the API, usually written in Assembly.

4

To high-level language has a higher level of abstraction, making it more like human language and leaving it farther away from machine code. The low-level language is more like machine code and uses only processor instructions, it is necessary to know the machine registers.

1

The binary classification, High Level x Low Level, is extremely simplistic and should no longer be used. Or at least be used only when accompanied by a more detailed explanation of the context in which it applies - it should always be relativised.

It can only be said that, on certain comparison parameters (explicit), the software developed with the language A has higher abstraction level than the software developed with the language B.

Let’s look at an example. If I ask to make a specific software, a software that deals with teaching the different types of numbers used by mathematics. This software will be of higher level in a language that has these different numbers internally and will be of lower level in a language that does not have, because it will have a huge work to build these concepts, even if it is supposed to be of higher level. That is, there is a correlation between the problem and the solution. It’s easier to nail a big nail with a big hammer, and a small nail with a small hammer. And it makes no sense to say that one hammer is low level and another high level.

That is, higher-level problems will be more easily modeled on higher-level languages. Lower-level problems will be more easily modeled on low-level languages.

Nor does it make sense to say that it is of higher level because it uses previously known terms. Example: Print ("5"); is not higher than: Print("5"); and Only because the first uses words I previously knew (English). I don’t see any differences for: Cout << "5"; Even, for me, the << redirect indicator facilitates understanding. It is more abstract and applies to different types of objects.

Finally, I think that the use of simplistic terms that at first facilitate understanding and learning quickly become a problem, because not everyone can handle/understand that that use was only for an initial understanding.

To make matters worse, many "+practical" teachers end up suppressing the concepts in favor of getting to practice faster, and students end up learning superficial (and often wrong) basic concepts. They end up developing various addictions and misconceptions, difficult to be corrected.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.