Zephyrnet Logo

Programming in Plain English

Date:

Star Trek had really smart computers, that you could simply tell what you wanted to do and they did it. The [Rzeppa] family has started a plain English compiler. It runs under Windows and appears to be fairly capable.

Plain language programming isn’t exactly a new idea. COBOL was supposed to mimic natural language with statements like:

MULTIPLY HOURS BY RATE GIVING PAYAMOUNT

You could argue this didn’t go over very well, but there is still a whole lot of COBOL doing a whole lot of things in the business world. Today computers have more memory and speed, so programmers have been getting more and more verbose for decades. No more variable names such asX1 and fprdx. Maybe this will catch on.

A function to clear the screen starts out with a list of phrases you might say to call the routine. This is similar to the type of personal assistant logic in which you can speak natural language, but in doing so you had better say something that matches its known template. Here’s the function:

To erase the screen;
To blank out the screen;
To wipe off the screen;
To clear the screen:
Unmask everything.
Draw the screen’s box with the black color and the black color.
Refresh the screen.
Put the screen’s box into the context’s box.

This will work if you say “erase the screen” or “blank out the screen” but it won’t work if you say “blank the screen.” The hello world program shown in the accompanying graphic looks like this:

To run:
Start up.
Clear the screen.
Use medium letters. Use the fat pen.
Pick a really dark color.
Loop.
Start in the center of the screen.
Turn left 1/32 of the way.
Turn right. Move 2 inches. Turn left.
Write “HELLO WORLD”.
Refresh the screen.
Lighten the current color about 20 percent.
Add 1 to a count. If the count is 32, break.
Repeat.
Wait for the escape key.
Shut down.

We were interested that some of the primitives let you insert machine code. For example:

To add a number to another number:
Intel $8B85080000008B008B9D0C0000000103.

That means you could do some interesting extensions if you were to take an interest. A cursory attempt shows it does work — at least somewhat — under Wine, if you want to try it out.

The post focuses on using the language with students, but we aren’t sure these are good habits for future programmers to develop unless it is the leading edge of a trend. We could make the same argument about Scratch and other visual development tools, too, though.

Source: https://hackaday.com/2020/06/12/programming-in-plain-english/

spot_img

Latest Intelligence

spot_img