Plain English Programming - Another kick at the can.
Posted: Sat Dec 23, 2017 4:35 pm
The Place to Start for Operating System Developers
https://f.osdev.org/
For English, the words "Uppercase the byte" are unnatural and should be replaced with something like "Convert the byte to upper case".mikegonta wrote:Plain English Programming - Another kick at the can.
Code: Select all
To figure out if two strings (that have lengths) are equal; compare the lengths, then compare characters from both strings in order (e.g. first character of one string compared to first character of the other string, then second character of one string compared to second character of the other string, etc). If anything (length or characters) aren't equal then the strings aren't equal. For character comparisons; characters with no difference other than case shall be considered equal.
The entire point of a plain English compiler is to prevent the need for people to spend a lot of time learning a new language and all of that new language's keywords and rules. This language fails to meet that objective. It'd be easier for someone who knows English to learn Python than it would be to learn the compiler's "plain English" language.DavidCooper wrote:Thanks for giving it another kick - I failed to appreciate it properly the last time.
You're right that it fails, but it's a good effort which succeeds to a much greater degree than I had expected. It does get clunky in places with such weird wording that there's nothing plain about it, but a lot of it does use simple natural wording which does the job. It's a working system which its creator clearly enjoys using and which may appeal to others.Brendan wrote:The entire point of a plain English compiler is to prevent the need for people to spend a lot of time learning a new language and all of that new language's keywords and rules. This language fails to meet that objective.
Having read the 120 page manual (which is well written and entertaining), it's clear to me that they did try, and they achieved a lot. However, with individual programmers being able to decide how words are used (i.e. what they mean) to extend the number of words it is able to respond to, I can imagine trouble when two programmers who've worked independently with the language for a long time get together to work on a shared project, although if that isn't a big problem for Forth, it may not be a problem for Plain English either. What really impressed me about it though was how well its creator handled the linguistics without going to the trouble of trying to do natural language properly - I expected it to be a useless pile of pants, but it's actually a high-quality, functional product which deserves to be recognised as such, and which is well worth taking a look at just to see what it does.I can admire someone that tried and failed (it is better than not trying at all); but it's obvious that these developers didn't even try.
The above is intended to explain an Arithmetic problem with interleaved text and calculations, the math version of the same way of programming in a human readable way without leaving calculations or code when needed to implement.Convert Decimal to Hexadecimal
If we have a decimal number like 121, we have to divide %16 and get the remainder. For the first iteration, the remainder is 121%16 = 121/16=7.... 7x16=112 121-112 = 9.
That (9) is the least significant digit of the hexadecimal number, it's the remainder of 121/16, it is the modulo 121%16.
After dividing 121/16, we are left with 7, since this is lesser than 16 and that's the remaining decimal number, that is the last digit, the next most significant digit.
The hexadecimal number is left as:
(7)(9)
Son, I've had a (close) look at Literate Programming in the early 1990's.~ wrote:What is unclear to you because you're still learning...
You're still looking at it from a beginner's perspective. Yes, a beginner might make optimization opportunities obvious (to an expert) if he is expressing intent verbosely. But that's 101 stuff you are talking about. Something that happens on StackOverflow or CodeReview.SE daily, without pamphlets surrounding the code. By the time you graduate, I'd fully expect you to write code that doesn't provide "chances of big optimizations at the code level", because you've had the stupid hammered out of you by that time.~ wrote:...it's highly useful to visualize chances of big optimizations at the code level, which will further be helped by the compiler optimizations, more than code without this feature.
You are still afraid of the state of the art, and want to drag it down to your level of understanding. I know that phase. Most aspiring developers run through it at some point. Some, sadly, stay forever stuck in there.~ wrote:Try it a few times and you will see how you can easily come up with extremely good natural optimizations that without the comments look as obscure as many compiler optimizations, despite being part of an average well-formed English sentence.
Not trying to put too fine a point to it, but you haven't even understood how a compiler works, let alone an optimizing one. As we've established rather clearly elsewhere, this is probably the best understood field of Computer Science.~ wrote:Who knows what would result if we translated all keywords to another language, who knows if writing code in other natural languages would result in other sorts or better optimizations for code written as regular technical document sentences.
So you're massively increasing the workload (and chance for error) for any refactoring or design change. You'd be surprised how often those happen, in the real world, compared to "clean slate" implementation.~ wrote:With this style we are practically writing a technical paper designed to be compiled, so the comments and the code need to be updated at all times for anything to even make sense as the text is so dense that it's just designed to be read and only execute a few key points, but they all have some syntactical structure so the text needs to be rewritten whenever a change is made, but the compiled result is simply superior to just write brief machine code fast that will later become rapidly unreadable for a human.
Lay-mans have no business at programming other than becoming better at it.~ wrote:It's just another win of the lay-man level at programming...
The objective is impossible to meet. Laymen don't have trouble programming because it's hard to pick up on the rules and keywords of a programming language. They have trouble programming because writing clear and correct instructions for complicated processes is hard. Natural languages are not precise, so the first thing you have to is rigorously define your terms and syntax. And once you've done that you suddenly have a new list of keywords and rules. Sure, those keywords and rules define an intelligible, if somewhat stilted, subset of a natural language, but you have to construct such a subset before you can get anywhere, you can't just use the natural language unmodified.Brendan wrote:Hi,
The entire point of a plain English compiler is to prevent the need for people to spend a lot of time learning a new language and all of that new language's keywords and rules. This language fails to meet that objective.DavidCooper wrote:Thanks for giving it another kick - I failed to appreciate it properly the last time.
Code: Select all
If the second word is a lastname...
You could if everything was worded clearly enough, but in reality you'd have the natural language compiler asking you for clarification (or confirmation) most of the time and repeatedly editing your instructions with you (still in natural language) until they're sufficiently precise to implement. That is how natural language programming will be done, and more of the editing of the instructions will be done automatically by software over time as it has more intelligence and understanding built into it. Initially, natural language programming will be no less work than using any programming language, so few people will get the point - every new detail of any required algorithm will still need to be worked out the hard way by a programmer, so it will take just as long to build anything. However, it will immediately mean that it won't be necessary to learn a programming language to write programs any more, and a new programmer will gradually learn how to produce better instructions in natural language that don't lead to so much interrogation and editing, guided by what they see happen as the compiler helps them rework their wording and the structure of what they're asking it to do. They will rapidly learn to think like programmers. Many different wordings will be able to represent the same instruction, so the programmer will be able to apply his/her own style on it much more than normal, but the machine code produced will be identical.linguofreak wrote:...you can't just use the natural language unmodified.
No; initially "natural language programming with compiler asking for clarification" will be so frustrating that people will commit suicide before any program is written; and eventually (after an infinite amount of time and multiple miraculous breakthroughs) the compiler will become smart enough to commit suicide itself.DavidCooper wrote:You could if everything was worded clearly enough, but in reality you'd have the natural language compiler asking you for clarification (or confirmation) most of the time and repeatedly editing your instructions with you (still in natural language) until they're sufficiently precise to implement. That is how natural language programming will be done, and more of the editing of the instructions will be done automatically by software over time as it has more intelligence and understanding built into it. Initially, natural language programming will be no less work than using any programming language, so few people will get the point - every new detail of any required algorithm will still need to be worked out the hard way by a programmer, so it will take just as long to build anything. However, it will immediately mean that it won't be necessary to learn a programming language to write programs any more, and a new programmer will gradually learn how to produce better instructions in natural language that don't lead to so much interrogation and editing, guided by what they see happen as the compiler helps them rework their wording and the structure of what they're asking it to do. They will rapidly learn to think like programmers. Many different wordings will be able to represent the same instruction, so the programmer will be able to apply his/her own style on it much more than normal, but the machine code produced will be identical.linguofreak wrote:...you can't just use the natural language unmodified.
After about 20 years of figuring out what the customer actually wants I can tell you that this will be, for the forseeable future, be beyond even AI levels of logic.DavidCooper wrote:You could if everything was worded clearly enough, but in reality you'd have the natural language compiler asking you for clarification (or confirmation) most of the time and repeatedly editing your instructions with you (still in natural language) until they're sufficiently precise to implement.linguofreak wrote:...you can't just use the natural language unmodified.