Friday, June 21, 2019

To Begin, Do a Change in Keywords for ZeptoN

The original goal I had in mind was to only introduce one new keyword into ZeptoN, and the rest is Java-centric syntax. The problem is that ‘do’ creates some processing problems with the transcompiler.
I considered something that is a mix of Java features like ‘do:’ which is more Pythonic, but in Java is a keyword used as a label. The problem is that it introduces a feature--a label, that is also a keyword, which is illegal in Java. 
I could by fiat make it legal in ZeptoN, but then it has to be unlearned when doing Java, or if a newbie moves up to Java.
Ultimately I opted to go Ruby-ish at the suggestion of a friend, but I’m old-school so it seems more Algol-ish...from the realm of Pascal and Ada95. The keyword change is to the ‘begin’ keyword.
Thus HelloWorld.zep becomes:
prog HelloWorld {
begin
println(“Hello World!!!”);
}
Java is verbose (actually a big help when debugging, or working on legacy source code), so another wordy keyword is not so much a problem. The trade-off is that while it simplifies the transcompiler, it does add another non-Java keyword.
So now ZeptoN has two keywords:
  1. prog - start of the program structure
  2. begin - entry-point of the program structure
I also considered “main” or “main:” since it would be a legitimate label in Java. The problem again is it takes “main” which is not a keyword, or label, respectively, and makes it once. So a user must be mindful of that fact.
Thus easier to use ‘begin’ which is not a Java keyword, and stands out in ZeptoN source code. So to allude to Lewis Carroll’s Alice in Wonderland:
“Begin at the beginning," the King said, very gravely, "and go on till you come to the end: then stop.”
Perhaps Lewis Carroll is among the first programmers like Augusta Ada King, Countess of Lovelace, albeit indirectly like a double C pointer **ptr.