views:

1153

answers:

18

No, really.

I've struggled to come up with a really great definition. Here's my take till now:

A programming language is a formal language, containing syntax. Syntactical rules are used to form statements. Programming languages are used to create a set of instructions that a computer can understand. A collection of syntactical statements is called a program.

I know it doesn't read very well, so it would be nice to have some help in this.



Here's Wikipedia's first paragraph on the topic:

A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication.

I think it's one of those things in life that everyone knows what it is, but it's deceivingly difficult to define.

Am I alone? Your thoughts?

A: 

The definition i like :)

Programming language is special vocabulary for instructing computer: a unique vocabulary and set of rules for writing computer programs

anishmarokey
A: 

programming language: a language used to control a computer

Doug Knesek
They're not "fancy", but "formal" - there is a difference, and a reason that they don't sound so simple
Claudiu
And the simple answer is?
Jim Ferrans
@Claudiu: formal =/= !simple.@Jim: see above
Doug Knesek
Why the down votes...just curious.
Doug Knesek
It's not a descriptive definition. The language itself doesn't control the computer.
dreamlax
I guess strictly speaking electrical signals control a computer...there's just a stack of thing that are used to control those electrical signals. These are called "programming languages".
Doug Knesek
+2  A: 

A programming language is a formal artificial language, with its own syntax. Syntactical rules are used to form statements. Programming languages are used to create a set of instructions that a computer can understand. A collection of syntactical statements is called a program. Those statements are translated from a human-readable format (either at runtime or through compilation) to a machine-specific format

klez
A language has always a syntax -- so you don't need to express it specially -- Wikipedias definition is more slim and complete (see my answer on that)
Juergen
+1  A: 

High level languages were invented so you wouldn't have to mess around with patch panels and cords anymore. Think of them as levels of abstraction between the hardware and the human instructor.

I use the term "high level language" to describe one that uses a parser, an abstract syntax tree, and a code generator to to translate its constructs into "low level" machine instructions.

I deliberately made "levels" plural because we have an increasing number of abstractions between us and hardware now: networking stack, operating systems, application servers, browsers, etc.

duffymo
This question has nothing to do with the "height" of a language, but with what a language is in the first place.
badp
I don't know what the "height" of any language is, but I believe that abstraction is what a language is about. At least I'm not repeating the same old stuff.
duffymo
badp, are you suggesting that a language isn't an abstraction of hardware? Care to explain C to us?
duffymo
C is an abstraction of hardware in the measure that there is a compiler that takes care of translating a more-or-less-hardware-aware program into processor bytecode. But that's just it -- a program written in a language. Also, various libraries may offer some sort of hardware abstraction to make it easier to write hardware-agnostic programs. But again -- that's just a program written in a language.
badp
Maybe it's just that I'm mathematically strict wrt definitions. See, this definition speaks of "high level languages" without defining, or knowing, what *is* "height".
badp
A "high level language" is one uses a parser, an abstract syntax tree, and a code generator to to translate its constructs into the "low level" machine instructions. You confused me when you needlessly threw in "height" of a language. I think that's a precise definition that even a mathematician could appreciate.
duffymo
I'm sorry for the confusion.
badp
+13  A: 

I think, Wikipedia has got this one very right:

A programming language is an artificial language designed to express computations
that can be performed by a machine, particularly a computer.

The first sentence is enough to describe what it is:

  • it is an artificial language (that is the root of it)
  • it is designed to express computations that can be performed by a machine (that is the target/purpose of the language)

This is what a programming language is in its most general definition.

Your definition lacks this generality (for example your sentences fit rather good for command oriented languages, but not for e.g. logical programming).

Juergen
Artifact: any thing made or used by mankind. What language isn't artificial?
Doug Knesek
Indeed. I'd say a programming language is a *designed* language. Most non-programming languages haven't been designed.
Joren
I think it's the difference of "natural" and "artificial". The former being developed as a natural process, and the latter being constructed explicitly (Esperanto being an artificial language, too, i think).
Johannes Schaub - litb
@Doug, the language of love?
Aiden Bell
the distinction between artificial and natural languages is that a natural language evolves organically based on the need of the society that speaks it. An artificial language is purpose built by one or a few people, with intent to use the language in a way that existing languages are unsuited. Mathematical notation is a natural language, having evolved over centuries according to need, and is learned bit by bit as needed. Esperanto is an artificial language, purpose built (by committee!) as a universal spoken human language.
TokenMacGuy
I understand the distinction between an emergent evolving language and a designed static one. But there's nothing inherent in a "programming language" that requires that they be one or the other. I work with my clients to *evolve* DSLs all the time.
Doug Knesek
esperanto is artificial, but it's not a programming language. i don't see artificial as a criterium. programming languages needn't be designed either. you can write a programm to generate a programming language, if you want to (because you can! :P). a programming language isn't necessarily translated into computation. all you can say with certainty, that it describes a programm, that is "run" on a machine, causing the machine to take actions.
back2dos
@back2dos: 1. two essential points where described -- meaning, both must hold, one is *not* enough. This is just logic. 2. your statement about "computation" and "taking action" is just juggling with words. Taking action and computation is essential the same for computers (computing is action for computers!). Also "express computation" does not mean that it actually is translated -- but it is aimed to. And this is rather the same thing you wrote -- juggling with words making the thing less obvious.
Juergen
@back2dos, just because programming languages are artificial, doesn't mean that any artificial language is a programming language. Also, if you write a program to output a programming language, it doesn't mean that the result language isn't design: You designed it.
Johannes Schaub - litb
i am not juggling with words. i'm trying to point out, that you define programming languages, by the traits, that they happen to have in general. in theory, you could write an english compiler, targeting a fancy toaster. nothing artificial, and it doesn't result in computation. a language represents instructions.you know, when you ask me, what a coffee machine is, i'm not going to respond, "it's a manmade machine, built with plastics and metal, using electricity to make hot water go through a mechanical filter". it's a machine that allows making coffee. that's all i can say with certainty.
back2dos
@johannes: by "generate a programming language" i meant "randomly generate". if you mean, it is designed, because it meets certain constraints inherent to my generation routine, i agree, yet personally, i have a different concept of the word "design". :)
back2dos
A: 

It is the best way to represent a logic, in a way that is close to the human language.

Satya
But what *is* it, not what does it (in your opinion it seams)?
Juergen
How, exactly, would you define "best"?By your definition there would be only one programming language. :)
badp
@badp nice one. hence the wars of languages.
Satya
A: 

A programming language is a formal language containing rules for syntax and semantics. These rules describe a way to express a program - a collection of computations - such that it may be converted to something that can be executed by a machine.

Michael Madsen
+4  A: 

Programming language is way to express commands and orders to specific actors.

Programming language consists of a notation and a set of rules, either expressed or implied, such that any actor that executes a program will not violate the rules.

I disagree that programming language has

  • anything to do with computations--see Logo
  • anything to do with computers--see any cookbook
  • anything to do with humans as a source of a program--see compiler that yields assembly
  • is just a way to encode/decode information--there's a plenty of stuff that do the same, but they're not P.A.
Pavel Shved
you can do computation with Logo
warren
What language doesn't "consists of a notation and a set of rules, either expressed or implied"?
Doug Knesek
Oh, COME ON! I know it can, I just used it as an example that "move turtle 90 units forward" can also be a programming language satement.
Pavel Shved
@Doug Knesek, the "set of rules" are not about syntax or grammar. They're about what actor will and will not *do*, when he executes the program.
Pavel Shved
Then your definition should simplify to: a language designed such that any actor that executes a program will not violate the language's rules.
Doug Knesek
In other words, legalese and the sort of language typically used by the military are programming languages. I don't think this a particularly useful definition.
David Thornley
Legalese is just a set of terms, it's a language with aim to transfer information. While programming language has an aim to express commands. Military lingo, having the same purpose, indeed *is* a programming language, the soldiers being the actors.
Pavel Shved
A: 

A programming language is a grammar describing what sequence of characters is a valid program, paired with a semantics defining what a valid program should cause the computer to do when executed.

Claudiu
A: 

A programming language is set of instructions to generate particular electronic signals, so that hardware can do those arithmetic's.

When i was taking Computer Architecture and Assembly language, it came to me its basically electronic signal which are generated against our computer instructions and trigger particular electric circuits to perform arithmetic's and then after each cycle they complete one instruction.

itsaboutcode
why does it have to be electronic signals? you could as well construct a computer that is mechanical/chemical/optical, whatsoever ...
back2dos
Well it we are talking about todays computer, they are about electronic ones, not mechanical ones.
itsaboutcode
You're defining computer programming. A programming language can exist without a computer and without even a compiler.
hasen j
@itsaboutcode: Why are you trying to define a concept in terms of what computers we're currently using? If somebody builds an experimental optical computer, and implements Forth on it, is Forth suddenly not a programming language? Heck, if we in general switch to some other basis for computing, will we not have programming languages any more? I think you're confusing concepts with implementations.
David Thornley
A: 

A programming language is a set of symbols, defined by a formal grammar, that can be translated by a program to another set of symbols that a computer understand, to make this last to perform some desired actions.

eKek0
A: 

Well, to be honest, i'd go with this definition:

A programming language is a language, that allows programming a machine.

This is the only thing, that all programming languages have in common.

Some are compiled, some interpreted, some follow formal syntax rules, some don't (for example rail ... no chance to put that into EBNF or whatever), some are human readable, some aren't (brainfuck) ... i do agree, that currently they are all moreless formal, but that's due to technical problems ... there is no other reason why all programming languages are formal, except the fact, that understanding real human language is currently too difficult (note: i'm not saying that no language would be formal, if processing human language was feasible to sufficient extents) ...

back2dos
+1  A: 

The first requirement is intent: a programming language is a language intended for computer programming. Note that this is not quite a tautology; recall that it is possible to program a computer by setting the bits by hand.... Anyway, all the other attributes of a programming language follow from its intent.

I do think a "real" programming language should be Turing-complete. This excludes things like HTML, which direct computers and are called languages, but which are not programming languages.

With any classification, you will get boundary cases; e.g., didn't APL start out as a mathematical notation? However, I think that returning to intent will get you as close as you're likely to get: for those boundary cases, the interesting questions are less relevant to the classification, anyway.

Edit: so, as an aphorism, then:

A programming language is a language intended or used for programming computers.

A real programming language is also Turing-complete.

comingstorm
I like your way of thinking on this. Pretty much in line with mine. Is it possible to add a succint, 2-sentence definition? It's just so hard to sum up the concept.
Redandwhite
A: 

A programming language is a way to express computations

  • Precisely
  • At at high level
  • In a way we can reason about them
Norman Ramsey
A: 
  1. A tongue-in-cheek reply: well I may not be able to define it, but I know it when I see it.

  2. If one has some sort of machine, that can be controlled by information that can be recorded in some time-persistent medium, where there has to be some kind of rules expressing what can be recorded, that set of rules could be called a programming language.

If the machine being controlled happens to be universal (in the Turing sense) then it's what we would typically call a computer, but simpler machines can also be programmed. I'm thinking of the Jacquard loom, or various controllable machine tools.

Mike Dunlavey
A: 

A formal language for describing processes/algorithms.

hasen j
+1  A: 

I wrote this down in notepad in order to clear my own thoughts about 'programming language'. I liked it and so searched for the question which it answers. "What is a programming language?". I contribute this here so that others may benefit from this.

A 'programming language' is a specially designed artificial language in which you can give instructions to the computer. Hence it can be called an 'instruction language' using which the programmer instructs the computer to do things.

The programming language (like C, Java, Python or Lisp) that a programmer uses to give instructions to the computer comes with an accompanying software program called an 'interpreter' or 'compiler' (or even comes with both of them) that understands this language. Hence it understands the programmer's instructions given in this programming language.

This software program also understands the special 'machine language' which is the only language that a computer machine understands. That is, the computer cannot understand instructions given to it in any other language other than the special 'machine language'. (Different computers have their own special machine language which is the only language that they understand. And so it is the only language in which they can take , and obey, instructions).

The computer cannot take instructions in 'programming language' because it only understands 'machine language'. The programmer does not know 'machine language' and only knows how to give instructions in 'programming language'. Since this 'compiler' or 'interpreter' understands both the 'programming language' as well as the 'machine language', it can translate the instructions given by the programmer in 'programming language' into the 'machine language' instructions so that the computer may know what the programmer is trying to instruct it to do.

A: 

Its a way softwares (computer programs) interact with each other. And its an interface to humans interact with computers.

Ramesh Vel