LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Discussion: how do you define a "high-level" language? (https://www.linuxquestions.org/questions/programming-9/discussion-how-do-you-define-a-high-level-language-512276/)

vharishankar 12-20-2006 10:37 AM

Discussion: how do you define a "high-level" language?
 
I used to think that high-level meant human-readable languages like C, C++ etc. and low-level meant assembly code and machine language.

But many people also use high-level to define languages such as Python - obviously meaning that C, C++ etc. are "lower" level.

I guess the difference really is in the level of "abstraction" that the language offers. That is how much it hides from the programmer and how much convenience it offers in terms of algorithmic and object oriented thinking. In other words, how easily your actual planning and design translates into code.

Is this a fair idea of the whole thing? I'd like some opinions.

asommer 12-20-2006 11:14 AM

That's pretty much exaclty the way I've always thought of it. I've always thought of Perl, Python, Ruby, VBscript, Basic and those languages as high level. Then Assembly, C, C++ at the lower level.

Then somewhere in the middle would be Java. My thinking might not be 100% correct, though. Interesting post by the way.

indienick 12-20-2006 02:06 PM

Programming language level is an inverse correlation between commands typed, and functions performed.

High-level lanuguages (Lisp, Perl, BASIC) require the programmer to type as few lines as possible, but perform the most functions, whereas low-level languages (Assembly, some aspects of C) require more lines of code for smaller performances.

I stipulate "some aspects of C", mainly because C, is quite a high-level language. C/C++/C# are no different than BASIC, except there are some additional features and different syntax. The aspects of C (and C++, C#) that I'm referring to are memory management.

Only some versions of BASIC allow you to toy with memory the way C does, but then again, BASIC's memory management is pretty good.

High-level: Python, Perl, Lisp, BASIC, C, Java, Ruby, any shell scripting language.
Low-level: C, Assembly, Java (sort of, but not really).

EDIT: This is just my classification of languages that I've used in the past, feel free to add to - or modify - the list.

graemef 12-21-2006 03:31 AM

When I was growing up (many years past) High level / Low level languages were defined by how close (or distant) the language was to everyday English. So assembly with its structure tied very closely to the architecture of the machine was considered to be quite low on the evolution scale of languages, whereas a language like Cobol with its flowery syntax was considered to be high up on the evolutionary ladder. Another high level language that appears to have found it's niche in the jungle is SQL. So the idea was if the language itself is dictated by the hardware it runs on then it is a low level language. If the syntax is just like English (or if you would prefer Spanish, Hindi Swahili, or any other natural language) then it is a high level language, otherwise it lies somewhere between the two.

Quite where on the continuum that leaves Perl with it's occasionally esoteric syntax I'm not sure :) Having said that I don't see any major difference between C, C++, Java, Pascal, PHP, Basic. Their fundamental syntax is almost the same. Where the modern languages differ from good old C is that they provide more libraries, not that the language itself is of a higher level.

vharishankar 12-21-2006 04:28 AM

Very interesting. I think we can classify C as fairly low level language since most C libraries *are* lower level. Also C lets the programmer handle the whole program memory and hides no functionality from the programmer.

With C++ it becomes more complicated as the levels of abstraction is really dependent on the design of the program and the Object Orientedness of it and the underlying libraries - which varies quite a lot from one library to another and one program to another.

I guess a lot of us, it's the level of abstraction the language provides towards handling programming concepts that make it "high-level" or "low-level" as well as how readable the language is in terms of human natural languages.

graemef 12-21-2006 08:20 AM

Quote:

Originally Posted by harishankar
Very interesting. I think we can classify C as fairly low level language since most C libraries *are* lower level.

Personally I don't think that the libraries that come with the language, define whether the language is a high-level or low-level language. Rather it is the syntax of the language. But the view of which languages are high-level language has changed over time see High Level Languages.

Dan04 12-21-2006 08:27 PM

A low-level language looks like this:

Code:

.text
.globl main

main:
  li  $a0, 0
  li  $t0, 1
  li  $t1, 100
loop:
  add  $a0, $a0, $t0
  addi $t0, $t0, 1
  ble  $t0, $t1, loop
  li  $v0, 1
  syscall
  li  $v0, 10
  syscall

A high-level language looks like this:

Code:

#include <stdio.h>

int main() {
  int i;
  int sum = 0;

  for (i = 1; i <= 100; ++i) {
      sum += i;
  }

  printf("%d\n", sum);
  return 0;
}

An even higher-level language looks like this:

Code:

print sum(xrange(1, 101))

Four 12-22-2006 12:04 PM

What I think is that there is no absolute high level or low-level. Its all respective to some language e.g. visualbasic is highlevel compared to c++, c++ is low-level compared to visualbasics. What determines the higher level (for me) is which is "closer to cpu". e.g. c++ could access memory directly, visualbasics extrachecks are usually performed automaticly. According to this for me java is highlevel compared to c++.

taylor_venable 12-22-2006 03:30 PM

Well, historically speaking, a "high-level" language was something not assembly, not shorthand, and not machine code. C used to be high-level, back when Unix was first invented (or more correctly, second reinvented, since the first Unix system wasn't written in C). But nowadays, compared to other languages, C is much closer to assembly than it used to be. The "level" of a language is a function of how many abstractions it makes compared to other languages that exist.

Object-oriented languages are fairly high-level; but pure ones (like Smtalltalk & Ruby) are more high-level than impure ones (like C++ & Java). But objects are only one kind of abstraction -- functional abstraction is another. Languages that provide functional composition, partial evaluation, and higher-order functions are also high-level. You can also have type abstraction. You get some of this in OO, but it also comes with type classes, functors, and generics (I'm thinking more along the line of type polymorphism here, not C++ template generics (although I suppose those could be counted too)). One last kind of abstraction (just off the top of my head) is modular abstraction, which breaks code into smaller pieces. Think packages in Java or modules in Standard ML.

So the more abstraction you've got, the higher the language "level" is.


All times are GMT -5. The time now is 03:56 PM.