views:

221

answers:

6

Hi

Wikipedia says:

A programming language is a machine-readable 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 specify the behavior of a machine, to express algorithms precisely, or as a mode of human communication.

But is this true? It occurred to me in the shower this morning that a programming language might just be a set of conventions, something that both a human and an appropriately arranged compiler can interpret. If that's the case, then isn't it this definition of a programming language misleading? If that isn't the case, then what's the difference between a compiler and the language it compiles?

Thanks!

z.

+3  A: 

I don't see what is different between what you are asking...

It occurred to me in the shower this morning that a programming language might just be a set of conventions, something that both a human and an appropriately arranged compiler can interpret.

... and the Wikipedia definition.

The key is that a programming language is just "a machine-readable artificial language".

matt b
what makes it machine readable, I think that's my question. What does machine readable mean. Thanks!
Ziggy
Well, machines have a built-in programming language that is extremely simple. It's interpreted by the CPU, and consists of instructions that map directly to the CPU's hardware capabilities. So that's the only truly "machine-readable" language on your computer. Other compilers are more or less intermediary tools to translate from more abstract programming languages into this very simple language.
mquander
And that one's machine-readable because it's built into the hardware. The CPU is hard-wired to look in specific places for the instructions it understands and to respond appropriately. The others, by proxy, are machine-readable since we have created a system to translate between them.
mquander
+4  A: 

A programming language is exactly that set of conventions, but I don't see why that makes the Wikipedia entry misleading, really. If it makes you feel better, you might edit it to read something like:

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

mquander
+2  A: 

A compiler does indeed act as an effective specification of a language in terms of a reduction to machine code - however, as it's generally difficult to understand a language by reading the compiler's source, one generally considers a programming language in terms of an abstract processing model that the compiler implements. This abstract model is what one means when one refers to the programming language.

That said, there are indeed many languages (Hi there, PHP!) in which the compiler is the only specification of the language in existence. These languages tend to change unpredictably at times as compiler bugs are fixed or introduced.

bdonlan
The compiler might also have bugs or purposeful omissions and changes; there's no guarantee that any compiler is actually a 100% faithful representation of a language (assuming that the language designers have created a formal specification elsewhere.)
mquander
It is, however, a 100% faithful representation of _the language that it implements_, which may not be equivalent to the language the programmer has in mind.
bdonlan
+1  A: 

Programming languages are an abstraction layer that helps insulate the programmer from having to talk in electrical signals to the computer. The creators of the language have done all the hard work in creating a structure (language) or standard (grammar, conjugation, etc.) that then can be interpreted by a compiler in terms that the computer understands.

Wayne Hartman
+2  A: 

I understand what you are saying, and you are right. Describing a programming language as a "machine-readable artificial language designed to express computations that can be performed by a machine" is unnecessarily specific. Programming languages can be more broadly generalized as established descriptions of tasks (or "a set of conventions") that allow one entity to control the behavior of another. What we traditionally identify as programming languages are just a layer of abstraction between machine code and programmers, and are specifically designed for electronic computers.

Programming languages are not limited to traditional computers (see the K'NEX Computer), and aren't even necessarily limited to computational devices at all. For example, when I am pleased with my dog's behavior, he gets a treat. When I am displeased, he gets nothing. Over time the dog learns the treat/no treat programming and I can use the treats to control his behavior (to an extent).

Bobwise
your dog might argue that he is controlling your behavior. ㅋㅋㅋ
Ziggy
A: 

All programming languages are really nothing more than domain specific languages for machine code or manipulating the registers and memory of a processing entity.

ennuikiller