Can plain English language be adequate as a program language?

ApacheKid

Joined Jan 12, 2015
1,762
There was an endeavor in the 70s and later to develop so-called 4th and later 5th generation languages, this was a bit of a fad with lots of hype, but anyone older than 50 might well recall this.
 

BobTPH

Joined Jun 5, 2013
11,537
There was an endeavor in the 70s and later to develop so-called 4th and later 5th generation languages, this was a bit of a fad with lots of hype, but anyone older than 50 might well recall this.
I remember when Prolog was going to replace all other programming languages.

And that is just the most ridiculous example.
 

nsaspook

Joined Aug 27, 2009
16,330
I tried using 4th. in the early 80s. It was clumsy and not very intuitive.
There are a few people that still use the language mainly in spaced based systems. Stack based, RPN styled, reentrant logic is not the easiest thing to GROK in programming even if the key words are english.

The Forth chip we still use was from that sector. It's used for very precise real time control of ION beam wafer dosing by directly executing Forth on the chip.
http://netwinder.oregonstate.edu/devteam/andrewm/forth/strongarm/docs/rtx2010.pdf
https://users.ece.cmu.edu/~koopman/forth/RTX_Backgrounder.pdf
 

Attachments

Last edited:

Thread Starter

richard3194

Joined Oct 18, 2011
193
Hi. What are my thoughts. A thread like this could go on and on, because there is potentially so much to enquire about. But, let me just say this as a near total newbie to PC's: It seems a matter of logic that if you attempted to use natural, conversational English to create an executable program, apparantly there would need to be a significant embedded artificial intelligence in the machine to allow the machine (machine that executes instructions) to act with precision and accuracy, indeed without failing because of ambiguity.

But, in any event, my understanding is, if you did write for a machine that could handle natural conversational English, (something that you would probably never do?) it would be called the Source Code. I think I'm right in that understanding.

Also, I'm thinking that what the compiler does with the source code that you write (such as C) manipules this source code such that it becomes "compatible" with a machine built for executing instructions. I have to read up on what that "compatible" is. Any possible hints on what would amount to being compatible? Obviously, it would be based on the workings of a machine built for executing instructions. (Somewhat going off topic of the title thread now - oops. Maybe I need a new thread)
 
Last edited:

KeithWalker

Joined Jul 10, 2017
3,608
#1 Would the lines written in plain English amount to source code and that is adequate? Why not?
The answer to that question was demonstrated to me years ago during a short course on communication:
I was given a sheet of paper with a very simple diagram drawn on it. I was asked to explain it in detail so the rest of the class could draw it, without seeing the original. They were not allowed to ask questions. Part of my job at the time was to write specifications for complex systems, so I can be very precise when explaining things. I described the position, size, shape and orientation of each component in the diagram. The result was not what I expected. Several people drew the diagram fairly accurately. Not one was perfect and some of the results were very far from perfect.
From that, I learned that even the most precise descriptions made in English contain ambiguities and are open to misinterpretation.
 

WBahn

Joined Mar 31, 2012
32,890
The answer to that question was demonstrated to me years ago during a short course on communication:
I was given a sheet of paper with a very simple diagram drawn on it. I was asked to explain it in detail so the rest of the class could draw it, without seeing the original. They were not allowed to ask questions. Part of my job at the time was to write specifications for complex systems, so I can be very precise when explaining things. I described the position, size, shape and orientation of each component in the diagram. The result was not what I expected. Several people drew the diagram fairly accurately. Not one was perfect and some of the results were very far from perfect.
From that, I learned that even the most precise descriptions made in English contain ambiguities and are open to misinterpretation.
I used to conduct a similar exercise with my Civil Air Patrol cadets. I bought several small Lego kits -- two each. I would then have two people sit back to back. The first person got the full kit, including directions. The other person just got a bag with the parts in it. The first person had to tell the second person how to assemble the kit. The second person got to ask questions. Everyone else got to to stand around and observe what both of them were doing.

I have yet to see any attempt result in something that was even particularly close to the intended results.

When possible, I would follow this up with the clip from Apollo 13 where they are building the CO2 scrubber adaptor.
 

MrChips

Joined Oct 2, 2009
34,830
Hi. What are my thoughts. A thread like this could go on and on, because there is potentially so much to enquire about. But, let me just say this as a near total newbie to PC's: It seems a matter of logic that if you attempted to use natural, conversational English to create an executable program, apparantly there would need to be a significant embedded artificial intelligence in the machine to allow the machine (machine that executes instructions) to act with precision and accuracy, indeed without failing because of ambiguity.

But, in any event, my understanding is, if you did write for a machine that could handle natural conversational English, (something that you would probably never do?) it would be called the Source Code. I think I'm right in that understanding.

Also, I'm thinking that what the compiler does with the source code that you write (such as C) manipules this source code such that it becomes "compatible" with a machine built for executing instructions. I have to read up on what that "compatible" is. Any possible hints on what would amount to being compatible? Obviously, it would be based on the workings of a machine built for executing instructions. (Somewhat going off topic of the title thread now - oops. Maybe I need a new thread)
While what you suggest with the use of AI is certainly possible, I think you are missing the point.
One goal of any programming language is to be able to write code that is absolutely unambiguous. This is why programming language syntax is rigidly defined.

Yes, AI could recognize when someone makes a spelling error such as wile instead of while, for example. But is that acceptable? I should think not. Any programming language can be more native language friendly by replacing operations with native language words. For example, APL would be rather obscure for someone not familiar with the syntax. Furthermore, it requires a special APL keyboard and a video display using APL fonts.

This is an example of a keyboard used for APL.
1713022116726.png

To overcome this for people without APL keyboards, there are implementations of APL that use natural words instead of the APL math operators, for example, floor, ceiling, roll, rotate, etc.

On another topic, the compiler does not have to create machine executable code. The trend today with HLL is to convert the "source code" into "intermediate code" or "p-code", or "Java code". Such languages are usually interpreted instead of compiled. It allows programs to be able to run across many different computer platforms. If remote downloading of executable binaries were prohibited, we would be able to build better secure computer systems.
 

WBahn

Joined Mar 31, 2012
32,890
If remote downloading of executable binaries were prohibited, we would be able to build better secure computer systems.
Very debatable. While it would mitigate one particular type of vulnerability, would it really actually result in better security? Look at the whole sea of vulnerabilities that have nothing to do with downloading executable binaries, including plenty that run just fine as some type of p-code on some virtual machine interpreter.
 

MrChips

Joined Oct 2, 2009
34,830
There is one way to eliminate one source of cyber threats - disconnect your computers and networks from the internet. Of course, one would still have to vet every data media being inserted into the system.

The next step would be to vet every code that is downloaded or has access to the system. Having all remotes access in a readable script allows for better scrutiny of potentially malicious code.
 

atferrari

Joined Jan 6, 2004
5,012
One goal of any programming language is to be able to write code that is absolutely unambiguous. This is why programming language syntax is rigidly defined.
In my ignorance, not having formal education on this subject, I always believed that the base is always the above. Like bank notes or the colors of traffic lights should be strictly the same for everyone using them. After all, not all the words in English (or any other language for the case) mean the same to all.
 

nsaspook

Joined Aug 27, 2009
16,330
There is one way to eliminate one source of cyber threats - disconnect your computers and networks from the internet. Of course, one would still have to vet every data media being inserted into the system.

The next step would be to vet every code that is downloaded or has access to the system. Having all remotes access in a readable script allows for better scrutiny of potentially malicious code.
Security is like secrets. It's possible to have it with three people, if two of them are dead.
 

nsaspook

Joined Aug 27, 2009
16,330
In my ignorance, not having formal education on this subject, I always believed that the base is always the above. Like bank notes or the colors of traffic lights should be strictly the same for everyone using them. After all, not all the words in English (or any other language for the case) mean the same to all.
The trick is to write code that fails predictably and gracefully. Once the code interfaces with the real world, absolutely unambiguous is a pipedream because we leave the world of mathematical determinism and enter the natural world of physics rules set by natural chaos and uncertainty that can't (by physics or expenses) be totally computed in any language.
 

ApacheKid

Joined Jan 12, 2015
1,762
The trick is to write code that fails predictably and gracefully. Once the code interfaces with the real world, absolutely unambiguous is a pipedream because we leave the world of mathematical determinism and enter the natural world of physics rules set by natural chaos and uncertainty that can't (by physics or expenses) be totally computed in any language.
You raise some interesting points. But I must take issue with "Once the code interfaces with the real world" because software never interfaces with the real world. In an MCU surely the software interfaces with very formally defined peripheral registers, no ambiguity there as I'm sure you'll agree.
 

nsaspook

Joined Aug 27, 2009
16,330
You raise some interesting points. But I must take issue with "Once the code interfaces with the real world" because software never interfaces with the real world. In an MCU surely the software interfaces with very formally defined peripheral registers, no ambiguity there as I'm sure you'll agree.
No, I don't agree. As usual, it has some very loose and shallow assumptions about embedded systems and hardware and what it takes to make robust systems instead of just correct systems.

The software receives natural chaos and uncertainty though those very formally defined peripheral registers as natural chaos and uncertainty in events to be programmed for. We also need to account for random hardware errors, hardware errata in memory, processors and those very formally defined peripheral registers for modules. The lists go on and on in the "real world".
https://embedded.fm/blog/ese101-chip-errata
https://www.microchip.com/en-us/pro...safety-and-monitoring/cyclic-redundancy-check

Now this assumes complete and total knowledge of the hardware, that's not a given with things like even a lowly ESP32 where some aspects are closed and are sort of accessible to programming with reverse engineering efforts of various levels of success.
 
Last edited:

Beau Schwabe

Joined Nov 7, 2019
186
There are idiosyncrasies in every language that you will need to watch out for. For example, the use of "OR" in the English language often implies an Exclusive OR where in computer language "OR" can be either one or the other or both.
 

Thread Starter

richard3194

Joined Oct 18, 2011
193
OK, I thought I'd better read up a bit. From Wikipedia on compiling: " In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a low-level programming language (e.g. assembly language, object code, or machine code) to create an executable program. " OK, so, I never realised that a compiler was a "computer program,". Don't know why. So, it's LILO (Language In Language Out". He he. So, have we a situation whereby the writer of the compiler code says to the source code guy, without me your going no-where with your source code? Or does the source code guy say to the compiler guy that it's the other way around? Not sure if my question is valid. Probably not.
 
Last edited:

nsaspook

Joined Aug 27, 2009
16,330
OK, I thought I'd better read up a bit. From Wikipedia on compiling: " In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a low-level programming language (e.g. assembly language, object code, or machine code) to create an executable program. " OK, so, I never realised that a compiler was a "computer program,". Don't know why. So, it's LILO (Language In Language Out". He he. So, have we a situation whereby the writer of the compiler code says to the source code guy, without me your going no-where with your source code? Or does the source code guy say to the compiler guy that it's the other way around? Not sure if my question is valid.
Many times the source code guy writes (there are compiler design languages Yacc) the first compiler for his new language and works to make it usable to at least one other person.
If sufficient people find X new language useful, then the source code guy says to the the compiler guy, I don't have time to fix all the bugs in the monster I created. Can you help?
 
Last edited:

ApacheKid

Joined Jan 12, 2015
1,762
OK, I thought I'd better read up a bit. From Wikipedia on compiling: " In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a low-level programming language (e.g. assembly language, object code, or machine code) to create an executable program. " OK, so, I never realised that a compiler was a "computer program,". Don't know why. So, it's LILO (Language In Language Out". He he. So, have we a situation whereby the writer of the compiler code says to the source code guy, without me your going no-where with your source code? Or does the source code guy say to the compiler guy that it's the other way around? Not sure if my question is valid. Probably not.
It's a truly fascinating problem space for sure. There are no hard and fast rules, personally I think we should think about a new language in a holistic way, how do we want to express various ideas, how might we extend the language in the future, what kinds of abstractions are the most important, are there alternative way to express things? which ways are better and why.

Once that's done, one can formalize and define a grammar, the exact and unambiguous rules for the syntax.

Compilers mostly follow an analysis/synthesis pattern, the source is structurally analyzed then that information used to synthesize an alternative representation.
 

Thread Starter

richard3194

Joined Oct 18, 2011
193
Is it the case that the compiler guy, (creating compiler code) needs to know both the source language & the target language, whilst the source code guy (writing apps, such as browsers etc) only needs to learn the source language (like C, etc). Of course, the compiler guy would also be a source code guy. I think.
 
Last edited:
Top