What programming language is most like natural language? [closed]?

Discover How To Stop The Daily Pain And Heart Wrenching Suffering, Put An End To The Lying, Face The Truth About Your Marriage, And Create A New, Peaceful, Harmonious And Joyous Marriage Get it now!

There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a lot like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. Here's a small snippet of Inform 7 code, taken from the game Glass, by Emily Short.

Stage is a room. The old lady is a woman in the Stage. Understand "mother" or "stepmother" as the old lady.

The old lady is active. The description of the lady is "She looks plucked: thin neck with folds of skin exposed, nose beaky, lips white. Perhaps when her fortunes are mended her cosmetics too will improve."

The Prince is a man in the Stage. The description of the prince is "He's tolerably attractive, in his flightless way. It's hard not to pity him a little."

The prince carries a glass slipper. The glass slipper is wearable. Understand "shoe" or "heel" or "toe" or "foot" as the slipper.

The description of the slipper is "It is very small for an adult woman's foot. " Complete code can be found here. This is a small simple example...it can actually handle a surprisingly robust set of ideas.It should be pointed out that the code isn't really a strange cypher where the constructs have hidden meanings...this code does more or less what you would expect.

For example: The old lady is a woman in the Stage. Understand "mother" or "stepmother" as the old lady. Creates an object that happens to be a female person, names that object "old lady", and places that object within the room object called the "Stage".

Then two aliases ("mother" and "stepmother" are created that also both reference the "old lady" object. Of course, as the examples get increasingly complex, the necessary hoops to jump through also become more complex. English is, by its very nature, ambiguous, while computer code is most definitively not.

So we'll never get a "perfect marriage".

7 Wow that's awesome - I'm sending this to my English teacher buddy – Mike Robinson Jan 29 '09 at 17:02 4 +1 now this is as natural as it gets – TStamper Apr 7 '09 at 21:32 2 @Zubair: Well, the language is very good at what it is designed for, which is the creation of text adventure games. It is actually remarkably robust at handling the vargaries of language, but it can also handle more abstact concepts like those that would be found in a puzzle oriented game. Many objects are pre-built into libraries, but a programmer can choose build objects with arbitrary sets behaviors from scratch.

Not surprisingly, the more abstract the concept, the further the language deviates from what one might deem "natural. " – Beska Feb 15 '10 at 13:34.

KTHXBYE IM OUTTA YR LOOP KTHXBYE On a serious note, VB is a pretty natural language.It's easy for non-programmer types to learn, so the syntax must be pretty easy to understand.

5 It might be "natural language" to someone who speaks TXT, like any teenager, but nobody that speaks real languages would understand that at a glance. – BenAlabaster Jan 29 '09 at 15:30 6 Sorry but VB is not a natural language.. I understand if you have been coding in VB for a while so it can look natural to you, so maybe your eyes have been VBfied – TStamper Apr 7 '09 at 21:31.

The language Richard Pryor used to transfer millions of dollars with in Superman III was very close: > TRANSFER $1,000,000 DOLLARS TO WEBSTER'S ACCOUNT.... NOW ;-) EDIT: characters corrected ;-).

If you're a connoisseur, the Shakespeare Programming Language is fairly natural ;) There is a limit to how 'natural' you can get in programming though. Human languages are too open to interpretation - a programming language needs to be specific and precise, I don't think that meshes well with having a 'natural' programming language.

Feb 27 '09 at 18:09 18 Uses up 100% CPU whining about its parent processes, doesn't do anything for days, and then finally kills all processes on the system including itself! – Phill Sacre Mar 2 '09 at 15:40.

COBOL reads a lot like English 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD.000300 000400* 000500 ENVIRONMENT DIVISION.000600 CONFIGURATION SECTION.000700 SOURCE-COMPUTER.

RM-COBOL.000800 OBJECT-COMPUTER. RM-COBOL.000900 001000 DATA DIVISION.001100 FILE SECTION.001200 100000 PROCEDURE DIVISION.100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN.100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.100500 DISPLAY "" LINE 15 POSITION 10.100600 STOP RUN.100700 MAIN-LOGIC-EXIT.100800 EXIT.Source.

2 Except the line numbers... – chills42 Jan 29 '09 at 17:22 18 When I used COBOL, we didn't have line numbers. We had to read it both ways, uphill, in neck-deep snow. – David Thornley Jan 29 '09 at 18:27 9 I heard that when COBOL was released, many people expected that there would be no more professional programmers within a few years - since obviously, COBOL was so easy to use that anyone who needed a program could write it themselves.

– Michael Borgwardt Jul 28 '09 at 11:56.

Good 'ol AppleScript touts its likeness to english as one of its strengths. However, it's not very fun to work with.

8 tell author "bartek" "I tend to agree" end tell – plinth Jan 29 '09 at 16:23 9 AppleScript is a read-only language =) – Sergio Acosta Feb 27 '09 at 18:09.

Lisp (of course (if you know what I mean (LOL))).

10 oh... I get it (damn right (it's really funny))! – Beau Martínez Jun 11 '09 at 21:18.

HyperTalk - the language behind Apple's HyperCard. On mouseUp put "100,100" into pos repeat with x = 1 to the number of card buttons set the location of card button x to pos add 15 to item 1 of pos end repeat end mouseUp HyperTalk on Wikipedia.

2 HyperTalk is also the ancestor of AppleScript. – bendin Jan 29 '09 at 16:50.

I don't know that I'd go as far as to say that VB. NET is close to the English language, but I think it's about as close as you really get. Sure, once you've programmed it for a while, it seems like English - it does read like a book to a seasoned VB programmer, but if you stop and think about real world English: For I As Integer = 1 To 10 Console.

WriteLine(" World") Next Is a long way from: Write " World" and move to the next line of the console 10 times. Of course, the English is ambiguous - does it want you to do the whole thing 10 times, or just write " World" once and then move to the next line 10 times? I guess we need to learn to talk in a less ambiguous fashion: Do this 10 times: In the console, write " World" and move to the next line.

But I doubt very much there's a programming language that really reads like English. Even those Cobol fanatics that say it's like natural language - it really isn't if you stop and think about how you think about things in a real way instead of in the manner defined by the programming language. Even in VB you're limited to the way the framework dictates the way you do things...

5 "SELECT ID, LNAME, FNAME, CONCAT(FNAME, LNAME) AS FULLNAME FROM tblA LEFT JOIN tblB ON tblB. FKID = tblA. ID" is like natural language?

– MusiGenesis Jan 29 '09 at 15:24 1 Damn - if that's like natural language - what the heck language do you speak? I mean, after you've coded in them for a while, sure it makes sense - but that's because you begin to think like the code, not the other way around. – BenAlabaster Jan 29 '09 at 15:26 1 To follow up, this is pretty readable: "SELECT id, last_name, first_name, CONCAT(first_name, last_name) AS full_name FROM people LEFT JOIN last_names ON last_name.

Id = first_name. Id" Like others have said, it depends on variable names. – Sasha Jan 29 '09 at 16:26 2 I dunno.

There's a big difference between "being able to infer what the statement will do" and "being like natural language". I'd say some of these examples of sql would be pretty easy to have novices decipher...but none of them are very much like a natural language. – Beska Jan 29 '09 at 21:08.

Well, Ruby and Python are supposed to be fairly close. Ruby even goes to the length of adding special keywords that simulate real life. Such as the unless keyword, etc.Of course, one you type real code in either of those 2 languages, it's not really like natural language, but then again what is?

1 I think "unless" is from Perl... – Adam Neal Feb 27 '09 at 17:59.

Well, Plain English, of course! (I haven't actually used this - I found it here. ).

Perl has some design principles that are based on how humans process natural languages (see wall.org/~larry/natural.html ). That's a different thing from syntactical hacks to make code read like sentences in English or some other language. I'm not entirely convinced that those are useful.As an analogy, I can also make ASCII art with my code, but that doesn't mean that my language is based on principles of visual composition.

To give an example of where it may not be useful,suppose this does what it looks like it does in some rubyish/smalltalky language: 3. Times say "hello!" That's nice, it makes my code a bit more readable, and there's a similar sort of fun in it to having a parrot that can talk, but it's only useful if I know the underlying rules of the computer language.

The fact that it happens to look like English gives me no extra leverage or insight. I can't use the English grammar processing engine in my brain to generate sentences like the following: // The dot looks like misplaced punctuation // in the "English" above, but it's essential in // the computer language 3 times say "hello!" // syntax error // In a natural language, a reordering might make // sense, but it's impossible here because the word // order was essential to carrying the parameters // to the method invocation in the right order. Say "hello" 3 times // syntax error.

2 Yep, but Perl needs all of the help it can get in readability, IMO. – kenny Jan 23 '10 at 11:30.

Forth is reverse-Polish based, and would work naturally for some people. "Learn Forth quickly I will" - Yoda.

2 . Mazdagz ein Ä™is aJ – Artelius Dec 25 '09 at 1:24.

Gherkin is a domain specific language to describe executable bdd-specifications. It is used among other by cucumber (ruby) and specflow (dotnet). Example Feature: Browsing In order to see who's been on the site As a user I want to be able to view the list of posts Scenario: Navigation to homepage When I navigate to /Guestbook Then I should be on the guestbook page Scenario: Viewing existing entries Given I am on the guestbook page Then I should see a list of guestbook entries And guestbook entries have an author And guestbook entries have a posted date And guestbook entries have a comment Scenario: Most recent entries are displayed first Given we have the following existing entries | Name | Comment | Posted date | | Mr. A | I like A | 2008-10-01 09:20 | | Mrs. B | I like B | 2010-03-05 02:15 | | Dr. C | I like C | 2010-02-20 12:21 | And I am on the guestbook page Then the guestbook entries includes the following, in this order | Name | Comment | Posted date | | Mrs. B | I like B | 2010-03-05 02:15 | | Dr. C | I like C | 2010-02-20 12:21 | | Mr. A | I like A | 2008-10-01 09:20.

The syntax of VB. NET is very near to English language.

Well natural language is equivocal, and takes a bit more than a literal linear reading to understand. But that being granted, VB. NET is getting close in some constructs.

Closest I've seen. For Loop in VB. NET For I = 0 To 2 'loop time!

Next I It's about as "natural" as I've seen without being too verbose.

I believe William Shakespeare was the world's best programmer... The Shakespeare Programming Language.

Assembly language. Oh, you meant natural for a human.

Sanskrit comes close to what you describe. It has no redundancies, it was the first language to follow BNF which is the basis of all modern prog. Language grammar, and its one of the languages from which English was born.

COBOL was created with the specific intent of being like natural language (English in this case).

4 and it proved perfectly that English is not suitable for writing large programs ;) – Aaron Digulla Jan 29 '09 at 16:46 1 @Aaron: Or even small ones - I had to think really hard about how to remove ambiguity from my English to write something that took me 5 seconds to type in VB... – BenAlabaster Jan 29 '09 at 19:29.

That is called "pseudocode". You use whatever means necessary to communicate the intent of the code (you have written or will later write). Any programming language has some features that are ambiguous to outsiders.

I wish there was a COmmon Business Oriented Language that read like English so everyone, even non-programmers could unterstand it... Maybe we should create one! (stolen from here).

With Ruby and Oslo (and possibly F#), you could build a very language-friendly DSL. That's at least the promise of Oslo. You can find an example of an Oslo grammar for BDD here.

Although not exactly what you asked for, there are languages that accomplish what you want, but from the other direction. Lojban, for example, is a language made to be used as a natural language, but without ambiguity. Lojban (pronounced ˈloʒban) is a constructed, syntactically unambiguous human language based on predicate logic.

I believe your question is based on a fallacy. Programming is not mainly about translating from human to computer language. It is understanding technical problems and designing programs that is hard, typing in the code is a minor part.

Learning a programming language won't make someone a programmer any more than learning musical notation will make them a composer. That said, if you write at a high enough level in almost any language and spend a few minutes explaining syntax, you can communicate the gist of a piece of code to a dedicated non-programer. Conversely, a precise enough natural language specification can sometimes be translated into high level functions (although people are rarely willing to put in the effort to write such a spec.).

Cobol is close to English as it gets I believe Logo is also not too far from the English language.

What we normally call "pseudo-code" is very, very close to Pascal. That probably doesn't make it particularly close to natural English, but if it weren't simpler than most langauges, we wouldn't write pseudo-code at all (we'd just write code).

I propose Lua. Sample Code: function modulus(num, mod) return num % mod end for I = 1, 1000 do local done = false if modulus(i, 3) == 0 then print("Fizz") else if modulus(i, 5) == 0 then done = true print("Buzz") end if modulus(i, 5) == 0 and not done then print("Buzz") end print(" ") end not the most english-like, but pretty darn readable even if I do say so myself!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions