just an idea ...im not a programmer yet starting college aug. c++ and java both have complex syntax and i cant learn on my own, python is good but not supported aswell and basic is really basic any more thanks to object oriented stuff

English the programming and scripting language

files are organized as books

-table of contents - quick access to chapters (organizational purpose)
-intruduction - contains licenses,code developers and other non esential data
-code
-chapters - contains different aspects of the program physics,3d,sound,input etc.
-paragraphs - block of code
-sentences - contain specific code
-bibliography - linked libraries and code from other sources
-thesaurus/dictionary - contains all variables and definitions

syntax

hello world

python:

print "hello world"

message = "hello world"
print message

English:

print text hello world.

message is hello world.
print message.

English:
will play sound if the mouse clicks on button

| line 34 | load image button.bmp and sound ping.wav // or load images button1.bmp, button1.bmp and sound ping.wav etc. //. Draw the image button.bmp to coordinates 320 and 240. If the mouse left click
| line 35 | on button1.bmp //or button1 is button.bmp// then play sound ping.wav //or ping is ping.wav//.


creates calculator

//note variables will be in thesaurus//
input 1 is null
input 2 is null
current display is null
operation is null
output is null

chapter 1 : calculator

The program name is English calculator, it has a window size of 320 by 240, it cannot be resized, it is refreshed at 30 fps.

Make and draw box called display, it is 128 px wide by/and 32 px tall, it is colored gray //or it has the rgb value of 255 by 128 by 64 //, it is at coordinates 10 by 10 . Print input 1 to coordinates 11 by 11, always update it. Make and print text 1, it is at coordinates 20 and 20, it has a size of 14. Make and print text 2, it is at coordinates 30 and 20, it has a size of 14. Make and print text 3, it is at coordinates 40 and 20, it has a size of 14. Make and print text 4, it is at coordinates 20 and 30, it has a size of 14. Make and print text 5, it is at coordinates 30 and 30, it has a size of 14. Make and print text 6, it is at coordinates 40 and 30, it has a size of 14. Make and print text 7, it is at coordinates 20 and 40, it has a size of 14. Make and print text 8, it is at coordinates 30 and 40, it has a size of 14. Make and print text 9, it is at coordinates 40 and 40, it has a size of 14. Make and print text 0, it is at coordinates 30 and 50, it has a size of 14. Make and print symbol x, it is at coordinates 50 and 20, it has a size of 14. Make and print symbol +, it is at coordinates 50 and 30, it has a size of 14. Make and print symbol /, it is at coordinates 50 and 40, it has a size of 14. Make and print symbol -, it is at coordinates 50 and 50, it has a size of 14. Make and print symbol = , it is at coordinates 50 and 60, it has a size of 14.

current display is input 1, it is always input 1 after reset. if mouse left click on text 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 0 then add place values into current input. Assign addition operation to |line 12| symbol +. Assign subtraction operation to symbol - . Assign multiplication operation to symbol x. Assign division operation to symbol /. if input 1 has values and if mouse click on symbol + or - or x |line 13| or / swap input 1 with input 2 in current display. If mouse left click on symbol = then add values fo input 1 and input 2 and store value in output and swap input 2 with output in current display. if mouse any click reset program

A "plain english" language was tried with COBOL. It didn't really work out. ;) The problems are verbosity and precision. Coming up with a precise grammar for the language makes it harder to understand than simple prose, and any language based on spoken languages will be much more verbose than more symbolic languages.

yeah but thats why it would be good, since there are so many words and ways to define a program

I find the argument about simplicity to be somewhat perplexing - C++ and Java have amazingly simple syntax rules when compared to any natural language.

I reckon you could summarise the fundamental syntax of most programming languages using a handful of sheets of paper; on the other hand, natural languages are enormously complicated - linguistics experts fill entire books documenting the structure of languages such as English - the number of varying factors of words in a natural language is vast.

e.g. consider the changing meaning of these words simply by fiddling with punctuation

"Clive bent over because the book had fallen on the floor to the left of the shelf..."
"Clive, bent over because the book had fallen; on the floor, to the left of the shelf..."
"Clive, bent over, because the book had fallen on the floor, to the left of the shelf..."
"Clive bent over; because the book had fallen on the floor, to the left of the shelf..."

All of those sentences are 'technically' gramatically sound (either on their own or as part of another sentence), but please do try explaining the difference to a non-english speaking human letalone a computer :-)


Perhaps what you mean is that you are more familiar with English than you are with Java or C++, and you also probably aren't too familiar with how computers "think" either - but thats because you probably spent your entire life learning and English, whereas you've probably barely spent any time at all trying to understand a programming language.

To think of it another way; Java is a popular "beginner language" in universities - A student who spends 150 hours in their first year of university studying Java could realistically gain a firm grasp on 50-60% of the language in that time. On the other hand, an English student learning the French language could spend 150 hours and be limited to conversations about clothes, birthdays, the weather, and buying a cup of tea from a shop; Sure, it might be easier to work out how a french native thinks (pretty much like you do), but to actually learn their lingo will take you many thousands of hours of practise.

commented: Nice arguments +4

To me, learning English language is far more difficult than learning a programming language.

There is a balance between making programming languages look like natural languages and having them be as unambiguous as possible. A lot of Lewis Carrol's work should make it obvious that slight differences in English syntax can lead to quite different semantics. In fact English is not as forgiving as most people would have you believe; can you tell me what's wrong with the following sentence?

Mary didn't yet know if he will confront Bob and I about his prior indiscretions.

Hint: There's a lot wrong with that sentence.

Dealing with the syntax is the easiest part of programming and of learning how to program.

> There is a balance between making programming languages look like natural languages and having them be as unambiguous as possible.

I would disagree, completely. There is no reason to make programming languages look like natural languages.

^ Then why do we use words like "for", "while", "if", "then", etc.? Might as well use "f", "w", "i", "t", etc. And why use infix notation? Why not just do everything in postfix or prefix; that makes compiling easier, and no need for parentheses. In fact, better yet, why not just write everything in freaking machine language. No ambiguity there.
So in summary I completely disagree that there is no reason to make programming languages look like natural languages; there is, and the fact that we have languages with mnemonics and high-level-languages with English/Math like constructs is a testament to this fact.
And FWIW I'm using "ambiguous" in the technical sense of the word, not the usual sense.
And if you don't think that programming languages mimic English a little bit, consider the following programs and honestly tell me that a guy off the street would understand them equally well:

Program #1
if a < b then c = a + b else c = a - b

Program #2
mov eax, a
cmp eax, b
jge noadd
add eax, b
mov c, eax
jmp done
noadd:
sub eax, b
mov c, eax
done:
(for instance)

Program #3
01101010011010100110101001101010011010100110101001101010011010100110101001101010011010100110101001101010011010100110101001101010
(for instance)

Sorry, I don't see any merit in your POV at all.

> In fact, better yet, why not just write everything in freaking machine language.
Straw man. Just sayin'.

^ More like a slippery slope, if that, but still.

And that being said, I don't think the comparison is so fallacious; he says that there is no reason a programming language should resemble natural language, and machine language is - IMHO at least - about as far away from natural language as you can get. I'd argue that it's not such a gross misrepresentation of his opinion at all. He says "There is no reason to make programming languages look like natural languages." I pointed out that we started with a language that was much farther from natural languages, i.e. machine language, and have since developed languages that are more similar in structure to English. Of course, I didn't make explicit the reason why we moved away from machine language - that should be obvious to anybody in a CS forum - but that reasoning completes a *valid* logical argument... perhaps not a correct argument, but if you want to go after the hypotheses than feel free.

A straw man would be to say that, if what he was saying were true, then nobody should use natural languages. That's a misrepresentation of what he said because he's talking about programming languages, not all languages.

But by all means, continue to post and I will continue to educate you, Radical Edward. And thanks for your valuable contribution to the discussion.

> But by all means, continue to post and I will continue to educate you, Radical Edward.
Ed would rather not, given the tone of your invitation. A civil and thought provoking debate rarely starts with phrases such as "and I will continue to educate you". ;)

"A civil and thought provoking debate"
- Yes, you definitely seemed to be the type for that, judging by your previous post, with the requisite irrelevant link to Wikipedia and lack of constructive contribution to my earlier post. And it's probably for the best we don't continue, because I actually don't speak any English, except what I have typed in this discussion and this sentence explaining it. Je suis le roi de France.

Then why do we use words like "for", "while", "if", "then", etc.? Might as well use "f", "w", "i", "t", etc. And why use infix notation?

"Natural language" doesn't mean using mathematical notation. Applying unique, memorable names to things is not the same thing as natural language, either. For example, sin^2(x) isn't natural language, and neither would be sine^2(x). If you've ever found yourself stumbling over saying "the expression <blah>" or "parenthesis <blah> end parenthesis" in an effort to be clear, you can see how mathematical notation is superior to natural language (for certain things). I don't think anybody would argue that "sum . map (** 3.0) $ [1..100]" is natural language, either, or that the uses of infix operators in that expression has anything to do with natural language. The dollar sign operator isn't even verbally pronounced.

Nor is the use of "if" or "for" or "let" or "function" in programming languages an example of natural language. They are memorable keywords used in various languages because it's common practice to let "if" be used for conditionals, "for" to be used for linear iteration, "let" to be used for declaring variables, and maybe "function" as a keyword used in function declaration syntax. When there is a line-up with natural language, it's more of a pun. "unless (x < 3) { ... }" is cute, but it's just cute. There's a reason why programmers who don't speak English as a first language end up using these keywords without problems, and why Ruby uses "class" and "if", despite being designed by some guy in Japan. It's notation, not natural language.

Being readable and understandable, and picking sensible variable names as a programmer or keywords as a language designer, is not an example of natural language.

Natural language would be

Put the power of the value in the transactional variable x to the value in the transactional variable z into the transactional variable y, atomically.

Notation is different.

atomically $ do
  xVal <- readTVar x
  zVal <- readTVar z
  writeTVar y (xVal ^ zVal)

lock (someLock) {
    y = pow(x, z);
}

Why not just do everything in postfix or prefix; that makes compiling easier, and no need for parentheses.

It doesn't make compiling easier. It makes parsing slightly easier. Maybe. Parsing infix expressions is not hard at all. Compiling stack-based languages into something sensible can be harder.

And lots of people happily use prefix notation languages like Scheme, Clojure, and Common Lisp, and often regard these as superior to any alternatives.

And if you don't think that programming languages mimic English a little bit, consider the following programs and honestly tell me that a guy off the street would understand them equally well:

Program #1

if a < b then c = a + b else c = a - b

A guy off the street would read this as a statement making a claim about the relationship between the variables a, b, and c, and not as something which modified a mutable variable c. This is an merely an example of a pun, and one which is not quite accurate. There is no reason to prefer this to the expression

c = if a < b then a + b else a - b

or to the C expression

c = a < b ? a + b : a - b

There is a big logical gap in the idea that finding an example of code that looks like natural language, or making one up, implies that looking like natural language is a desirable feature.

mov eax, a
cmp eax, b
jge noadd
add eax, b
mov c, eax
jmp done
noadd:
sub eax, b
mov c, eax

This looks a lot like natural language to me. We could invent an assembly language that looks very much like natural language.

Copy a into eax.
Compare eax and b.
Jump to noadd if the last operation set the greater-than-or-equal-to flag.
Add b to eax.
Copy eax into c.
Jump to done.
I dub this location "noadd."
Subtract b from eax.
Copy eax into c.

Now that's an example of natural language. If assembly language looked like this, we might end up thinking that the move to languages like C or Python was a step away from natural language. But that would also be as much a fallacy as to regard the invention of higher level languages as a step towards natural language. If we look at what higher level languages add, it's not natural language. It's tools for abstraction. The ability to define variables and define structures without manually computing offsets, the ability to write loops using matched braces instead of named labels, the ability to have stack mechanics and function call mechanics automatically generated instead of writing it every time: these are the abilities that C gives you and that make C preferable to assembly. The reasons to prefer higher level languages to C also have little to do with their notation or any other movement on the "natural language" axis.

Just look at the arguments people make about why their preferred language is better. That's proof enough.

commented: Excellent argument +5
commented: Excellent post +4
Member Avatar for iamthwee

OK, so let's say someone has the following problem:-

"Hey, I want this program to calculate the sum of all student scores but first remove all duplicate lines. The file is arranged like so . . ."

Essentially, this task is achieved by a layman communicating this to a skilled/mediocre programmer who uses his chosen programming language of choice to complete the task.

What the OP is asking for is a means to cut out the middle man (i.e. the programmer.)

Now we know, that any Turing complete language can achieve this task. But the above quotation:-

"Hey, I want this program to calculate the sum of all student scores but first remove all duplicate lines. The file is arranged like so . . ."

This is far too vague to be of any use. Therefore the answer is to employ an super advanced form of AI to translate the above quotation into a set of finite steps to arrive at what is commonly defined as an algorithm.

So the answer is, a language can exist but basically, it would just emulate what a skilled programmer is asked to do on a daily basis by his non-technical boss.

The language would effectively be a super AI.

>what original poster is asking for is a means to cut out the middleman (programmer)
>the language would effectively be a super AI

i suppose the ambiguous nature of natural language would be resolved by the "super AI" But I dont see how the super AI is going to deal with people who cant express themselves clearly.

many people can understand a language perfectly and even speak it perfectly but their way of reasoning is so messed up that they simply dont speak right. in other words there is a discontinue between the logical and language faculties of their minds. Or maybe its not a discontinue but merely the fact that their logical reasoning is not as correct as it should be.

such a super ai would be like a genie grating wishes but most people who ask for it would go: "Well technically speaking this is what I said but it is not exactly what I had in mind..."

I pointed out that we started with a language that was much farther from natural languages, i.e. machine language, and have since developed languages that are more similar in structure to English.

Seems you are over-fitting your observations of programming language evolution of C-like languages. Take a look at array programming language named J, which descended from APL in 1990.
http://en.wikipedia.org/wiki/J_(programming_language)
Quicksort algorithm written in J is:

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)

Is it closer to natural language ? Or is it closer to machine language ? Or maybe is it closer to neither ?
Still you may ask some fans/matematicians which uses J for math related problems quick research, and I guarantee that you will get answer Where is the power of tacit programming J language. So in the end you may understand that programming languages (like natural languages) evolves in many directions. The only reason for language to be alive (like natural one) is active community of developers that still develops in that language. Thats all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.