34

I've heard these terms thrown around describing languages before, like C is not quite a low-level language, C++ is a midlevel, and Python is a high-level language.

I understand that it has to do something with the way the code is compiled, and how it is written. But what defines a language into one of those three categories? Are these absolute categories, or just a general idea programmers use to describe languages to each other?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Narcolapser
  • 5,895
  • 15
  • 46
  • 56
  • 1
    possible duplicate of [Which programming languages aren't considered high-level?](http://stackoverflow.com/questions/2624781/which-programming-languages-arent-considered-high-level) – danben Aug 12 '10 at 13:35
  • they are similar question, but different angles. He wanted to know why talking about these things are still relevant, I wanted a definition of the terms. Looking at the accepted answer for both kind of speaks for the difference between our questions. Also my is a community wiki. :3 I'm more interested in getting everyone to agree on a definition. – Narcolapser Aug 12 '10 at 13:58

12 Answers12

74

Yes, they're just general terms. It's to do with abstraction, and how close you are to what the computer's actually doing.

Here's a list of programming languages ranging from very low to very high level:

  • Machine Code could probably be considered the lowest level programming language.

  • Assembly language is at the level of telling the processor what to do. There is still a conversion step towards machine code.

  • C is a step up from assembler, because you get to specify what you want to do in slightly more abstract terms, but you're still fairly close to the metal.

  • C++ does everything that C can do but adds the capability to abstract things away into classes.

  • Java/C# do similar things to C++ in a way, but without the opportunity to do everything you can do in C (like pointer manipulation in Java's case [thanks Joe!]). They have garbage collection though, which you have to do manually in C++.

  • Python/Ruby are even higher level, and let you forget about a lot of the details that you would need to specify in something like Java or C#.

  • SQL is even higher level (it's declarative). Just say "Give me all the items in the table sorted by age" and it will work out the most efficient way to carry this out for you.

kulukimaki
  • 47
  • 5
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
  • What about lisp? I would put that even higher than SQL. Also C# has pointer manipulation (unsafe blocks). – Joe D Aug 12 '10 at 13:32
  • 3
    @Joe D I would put lisp at the same level as Python probably. You still have to use programming constructs like conditionals and functions to do stuff... Unless of course you're on an old fashioned LISP machine, in which case it's low level B-) – Brian Postow Aug 12 '10 at 13:50
  • 1
    where would you put Shakespeare? ; ) http://en.wikipedia.org/wiki/Shakespeare_%28programming_language%29 – Narcolapser Aug 12 '10 at 14:01
  • @Brian: I agree, lisp is probably around the same level as python, if not slightly higher. @Narcolapser: Probably at the same level as assembly, for it's lack of expressiveness, in other words very simple programs are very long. – Joe D Aug 12 '10 at 14:09
  • 1
    @narcolasper I think that there's a totally different scale for "silly languages" they aren't high, or low, or anything inbetween, they're just silly. Shakespeare, OOK, Brainf*ck, INTERCAL, etc are all silly. – Brian Postow Aug 12 '10 at 14:39
  • @Brain I think propositional logic had a term for that. Reductio ad absurdum. or Reduced to absurdity. or in this case, abstracted to absurdity. xD – Narcolapser Aug 13 '10 at 03:48
  • I dissagree, lisp should be at SQL level or higher, you can implement logic based or higher level paradigm type DSL's in lisp, where it will figure out the best way to do it. – Anandamide Jul 06 '16 at 20:17
  • There is a difference between managed C++ (.NET) which has Garbage Collection etc and standard C++ which doesn't have GC. – Daniel W. Oct 21 '16 at 12:42
24

low level = long development time + very fast executable file

high level = shorter development time + slower executable file

mid level is between the two

Manish
  • 353
  • 2
  • 18
EKanadily
  • 3,831
  • 3
  • 35
  • 33
  • 1
    I don't know who voted that down, it is actually a pretty good statement when you think about the answers above. – Narcolapser Nov 06 '10 at 04:12
  • +1 I agree with Narcolapser- it's definitely generalized but seriously, true. – Dominic K Nov 06 '10 at 18:14
  • 4
    indeed. people don't think about the answer ,they just vote :) – EKanadily Nov 09 '10 at 11:11
  • it's only tangentially correct - is probably why people downvoted. – maxwell Jun 24 '16 at 14:40
  • 1
    It is not correct. A high level programming language isn't necessarily slower than than a low level programming language. I'll give you an example: scala is much higher level than java and provides many ways to work with multithreading and collections that perform better than it's java's equivalent. – 0x6C38 Jul 26 '16 at 21:39
  • @Mr D : sorry mate but both java and scala are high level with varying degrees of "level". remember that from "low level" to "high level" there is a spectrum. notice also that language performance differ from domain to domain depending on where that level excel VS where is struggle. – EKanadily Jul 27 '16 at 06:56
  • @docesam scala's and java's domain is the same. And they do have varying degrees of "level", if you mean to say that scala is higher level in every aspect – 0x6C38 Jul 27 '16 at 16:20
15

Very low-level: Machine Code

Low level: Assembler, Forth

Mid level: C, C++, most system programming languages

Mid/High level: D, Go, garbage collected system programming languages

High level: Java, C#, most interpreted languages

Even Higher level: Lisp dialects

Highest level: SQL, declarative programming languages

If there is anything else to be added, tell me.

Joe D
  • 2,855
  • 2
  • 31
  • 25
5

They aren't absolute. They are all relative to what other languages are being used in industry at the time. For example, there was a time when assembly was considered mid-level.

The 'level' is essentially a measure of how abstracted the programmer is from the actual hardware-based operations. In a low level language you might have to care about actual memory locations, whereas in a high-level you just create variables and let the OS handle memory.

A normal CPU processes either 32 or 64-bit instructions. In the simplest form, think of this as an 32 1's and 0's in a row - that's what the processor actually interprets and executes. Writing this directly (machine code) would be the 'lowest-level'.

Adam S
  • 8,945
  • 17
  • 67
  • 103
2

Low level means closer to the machine, and therefore more difficult and more powerful. The higher level you get, the more removed from the machine and "English-like" you get, but you lose a lot of the power and functionality that comes with being able to control the minute details of the machine. Higher level languages also generally tend to protect you more and have much more precautions and checks in place, while lower level languages trust you, so to speak, and let you play around at your own risk.

froadie
  • 79,995
  • 75
  • 166
  • 235
  • English like isn't really a good metric, because then you get COBOL as a high level language... – Brian Postow Aug 12 '10 at 13:51
  • Definitions of power vary, for example is assembly more powerful than lisp? That depends on what you mean by power, if power means that all features of the machine are available then yes, assembly is more powerful. But, if it means that more can be expressed in fewer lines of code (in this case much, much fewer) then lisp is clearly more powerful. – Joe D Aug 13 '10 at 15:03
2

The term mid-level language is one I've never heard.

"Low" and "High" refer to how "close" to the machine you are in your programming. The lowest level would be machine (binary) code. Next (and still considered low) is assembler. The higher level languages involve more symbolism and constructs that are supposed to be closer to how humans normally think. C (and somewhat C++) has a reputation as being somewhat a hybrid low/high level because it has many constructs that are in high level languages, but also has instructions (e.g. shifts) that are low level languages but often not in higher level languages.

GreenMatt
  • 18,244
  • 7
  • 53
  • 79
1

From low to high, you can categorize the languages as follows.

Machine Code --> Assembly Language --> Compiled Language --> Interpreted Language

Remember that these aren't absolute black and white definitions, but rather shades of gray. This is more of a guideline than a rule.

Think of machine code as a long string of 1s and 0s understood by the native platform. Consider this your baseline... the lowest "level" you can have.

Assembly language could be considered a symbolic representation of this. I believe there is a 1 to 1 mapping between assembly code instructions and machine code instructions. This is your low level language.

Java and C++, for example, are both compiled languages, but many would consider C++ to be a lower level language than Java because it exposes low level system access, while Java runs in a protected environment (the virtual machine). Remember that a compiled language is compiled (converted, if you will) to machine code before execution. C is also a compiled language, but would be considered lower level than both Java and C++.

For our sake, we will say that C and C++ are low level languages because they offer (relatively) little abstraction from the hardware and direct memory management. In actuality, they fall somewhere between low and mid, as you will see soon enough.

We will call Java and C# (.NET) mid level languages because they have automatic memory management (garbage collection), plenty of high-level abstractions (IE objects... yet C++ supports objects. Do you see why the scale is considered to be loosely defined?)

With an interpreted language, the interpreter resides in memory and reads the source code directly. These are high level languages. Python, Perl, Javascript, and PHP are all examples of high level languages.

ravibhagw
  • 1,740
  • 17
  • 28
1

High Level Language: Easily readable, focus on productivity, easy to work with and offers abstraction from the details of computer/hardware. e.g. – Every programming language except Assembly language & Machine code)

Low Level Language: Non-readable/understandable, provide more direct control over the system, harder to work with, and offer little or no abstraction from the computer. e.g. – Assembly language, Machine code (lowest level).

Middle Level Language: Consider MLL, as the language which provides a bridge between above two, and often C\C++ tagged as a middle level language it is because they offer features of HLL and LLL.

  • High level feature: Relatively understandable syntax, function, data structures.
  • Low level feature – provide control over memory management through pointers and direct manipulation of memory address.
Trishant Saxena
  • 388
  • 3
  • 14
0

C is a midlevel language, because we can use code in assembly language.

The only slight difference is pointers make it powerful (if pointer remove in C then it be will considered a low-level language). Its portable features makes it midlevel, so we can say it is a midlevel language.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

It is all relative... The "level" reflect the amount of abstraction.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

Once you add a spectrum of levels of a programming language you add nuance to the definition.

Clearly machine code and assembly are machine-dependent. C and C++ in theory are machine-independent, but in truth that is not universal. In C, things like alignment need to be taken into account and you can always manage the stack in C and in the C subset of C++) via a pointer and a single initialised variable—if you are crazy enough—so that (x86) the RSP register (stack pointer) is never used. So C, yes it is midlevel. Everything else is high-level and some super high-level.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
cdcdcd
  • 547
  • 1
  • 5
  • 15
0

Low-level languages are very close to machine language that may be binary or RTL. It is hard to write and very quick to execute. It can interact with the hardware and a high-level programming language is very easy to write, but it can be executed after compilation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131