paint-brush
What the Do-While is ZeptoN? Part III: A Taste of ZeptoN...by@wfgilreath
103 reads

What the Do-While is ZeptoN? Part III: A Taste of ZeptoN...

by William F. Gilreath13mJuly 11th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The elements or the words, numbers, operators, literals used to write programs in ZeptoN are examined, discussed with examples of the elements.
featured image - What the Do-While is ZeptoN? Part III: A Taste of ZeptoN...
William F. Gilreath HackerNoon profile picture
0-item
1-item

After getting, installing, and running Zeptor to create, program, and execute ZeptoN programs 😜 let us look at what is the programming language ZeptoN–a taste of ZeptoN. Okay, now to “Zept to it!”


A programming language is a medley, pastiche, or collection of concepts like a salad or fruit cocktail. Much like a natural language such as English or Latin, there are different concepts and entities that all together create the language. ZeptoN is a programming language, an artificial language, yet likewise has a mixture of concepts and entities. Now for a taste of these in ZeptoN 😉 …

Part 1: What's in a Name?

The name 'ZeptoN' is not unique, there are other ZeptoN entities. Yet the name 'ZeptoN' is a portmanteau of two words. The word 'zepton' is for a very infinitesimally small measurement of time, and the word or letter 'N' is for the Nth or umpteenth programming language.


The time measurement 'zepton' was inspired by a science news article [Temmi 2021] about the shortest time measurement, for the time a photon crosses a single hydrogen molecule. The timing is 247-zeptoseconds or 0.000000000000000000247 seconds.


ZeptoN at the time (2020) was the umpteenth or Nth programming language, or language^N the Nth degree of a programming language.

Thus 'Zepto' + 'N' = ZeptoN and why ZeptoN has both the first and last letter capitalized. 😜

Part 2: What is a Program?

In ZeptoN, a program is a unit of execution or runtime functionality. Essentially, an application or "app" is a program. A program accomplishes a task, something the app does. Example programs are LibreOffice Writer, which is a program, the Firefox web browser which is a program, and Zeptor, which is a program. All of these programs are applications.


A program is a set of instructions that causes a computer to perform predictably. A ZeptoN program is nothing more than a sequence of characters, like a paragraph or a poem, stored in a file with a .zept extension.


A ZeptoN program comprises sets of alphabet letters the processor understands as words. The words form expressions, statements, and functions. A complete set of such words makes up the ZeptoN programming language.


The process of writing those instructions for a computer is called programming in ZeptoN. You can write programs to accomplish an amazing variety of tasks. Writing a computer program using ZeptoN is a direct process. You have a particular task you would like the computer to do for you. You tell the computer in a logical, procedural set of steps how to accomplish that task. The program is the code, the software that tells the computer how to do the task.


A ZeptoN program takes data, and information as input, processes the data by the instructions in the program, and then takes the resulting data, and outputs or sends the resulting data or information to the user.

Part 3: Elements of ZeptoN

The elements of a ZeptoN program, the words are of different kinds of words. There are comments, identifiers, numbers, text, and operators. The elements are used to write a program with functions, statements, and expressions–which are discussed, examined, and evaluated later.


The elements of ZeptoN we will have a taste of are:


  • Comments
  • Identifiers or Words
  • Numbers
  • Text Literals or Literals
  • Operators

Comments

Programming languages are for human beings, not computers or processors. Comments reflect this idea, as they provide a means for remarks or comments about the source code of the ZeptoN program. For the task done by a ZeptoN program, comments are ignored by the transcompiler. Effectively a comment is simply a long series of ignored characters and symbols.


A simple guideline or heuristic about comments is that: A comment can be your best friend, or a comment can be your worst nightmare in a ZeptoN program.


There are two forms of comments in ZeptoN:


  • Singular-line comments, or 1-line comment
  • Multiple-line comments, or N-line comment

Singular Line Comments

Singular or single line comments begin with a double forward slash or '//' and then continue until the end of the line. In theory, singular line comments can be a long line of characters, symbols, and text. However, for readability, a comment is often the maximum length allowed for a line, as 78 characters or 80 characters, often called the number of columns per line.


An example of a single-line comment is:


double PI = 3.14159; //define PI as approximate value

//This is a short comment about nothing. 

begin {  

     //nothing to see here!

}//end begin 


The singular line comment is used to explain the absence of any code, and then to indicate the end of the begin structure used in the source code of a ZeptoN program.


Singular line comments are useful addendums and annotations to explain design decisions, code changes, and other useful information for the programmer about the ZeptoN program.

Multiple Line Comments

Multiple-line comments are like the singular line comments, only the comment can span multiple lines. The ZeptoN multiple-line comment has a start prefix and close suffix. This delimits or indicates the series of characters and symbols as a multiple-line comment--the head and tail of a comment.


The multiple-line starting prefix is '/' slash-star and the closing suffix is '/' star-slash. Both are mirror images of the two characters used to indicate a multiple-line comment.


An example of a multiple-line comment is the header of a sample ZeptoN program; the header is a comment with multiple lines and describes the basic information about the ZeptoN program.


Consider the header from the sample ZeptoN program HelloWorld.zept to illustrate:


/*    

    Name: HelloWorld.zept 

     Title: HelloWorld program. Description: The HelloWorld program implements the ubiquitous greeting "Hello, World!!!"

     Author: William F. Gilreath ([email protected]) Copyright (c) 2024 William F. Gilreath. All Rights Reserved.

    License: This software is subject to the terms of the GNU General Public License (GPL) version 3.0 available at the following link:

      http://www.gnu.org/copyleft/gpl.html.

      You must accept the terms of the GNU General Public License (GPL) license agreement to use this software. */


Another use of multiple line comments is for a function, to describe the function, the parameters, and the resultant value of the function. Multiple-line comments are useful and more convenient than a single-line comment when a longer and more verbose commentary is required in the source code for a ZeptoN program.

Mixing Comment Forms

A multiple-line comment, in theory, can be a single-line comment, or fit within a single line--the N-line comment is where N = 1. However, just as multiple-line comments are more expedient for longer commentary, a singular-line comment is better for a simple comment on one line than a multiple-line comment.

Style of Comments

Often a technical organization or department will have some style guide for source code, that includes how to organize, structure, and format comments.


For example in the C programming language there is the "Indian Hill Style Guide" [Canno 1990] and then Kernighan and Plaugher wrote a book "The Elements of Programming Style" [Kerni 1978] about rules to follow to write for readability.

Identifiers or Words

An identifier or word in the ZeptoN programming language is a word, following several rules for naming much like many written languages like English. Unlike English words, the words or identifiers in ZeptoN are case-sensitive. Thus the three ZeptoN words:


prog Prog PROG


All three words or identifiers are unique and distinct in ZeptoN but are the same thing in English.


The following words are valid identifiers in the ZeptoN programming language:


void

if_flag

me

prog

ReadyBoolVar

begin

dataFile

doIt_Now

x

Int32var


The following words are invalid identifiers in the ZeptoN programming language:


_myFile

ready$Flag

what!WTF

$myVarmy@var

321-contact

_$myVar

123_for_me

helloWorld


Rules for Words or Identifiers

The rule for a valid word or identifier in the ZeptoN programming language is:


  • Rule 1. A ZeptoN word can consist of numbers, letters, or an underscore '_' character.

  • Rule 2. A ZeptoN word must begin with lowercase or uppercase letter.


Note that as ZeptoN uses Unicode the letters are not from the Latin alphabet. Examples of valid words in ZeptoN with non-Latin letters are:


  • ९नमस्ते – this is the Hindi word for "hello"

  • αρετη – this is the Greek word for "virtue"

  • Straße – this is the German word for "street"

  • débil – this is the Spanish word for "weak"


Some words are reserved words or keywords. These are the words used by the ZeptoN programming language, but the keywords are a future topic, and the transcompiler will detect using a keyword as a word or identifier.

Names

Choosing an identifier is choosing the name of a word. There are many styles and standards for choosing an identifier or word in ZeptoN. Ottinger [Ottin 2021] described the heuristics and guidelines for choosing an identifier. The important idea is that ZeptoN is a programming language, for human beings, not computers, so choose and craft a meaningful name.


Numbers


Numbers are datum and have two primary kinds of numbers: integers and reals. However, numbers in ZeptoN come in many kinds or types, which are examined later. Consider the following numbers:


255.0

255


The same numeric value, but different kinds of numbers. The 255.0 is a real number, and 255 is an integer number. Numbers can be written in different forms. Consider the following hexadecimal number:


0xFF

0xff


This is hexadecimal, or the number is written using a non-decimal or base 10, or a different number system, for hexadecimal base 16.


Consider that the following numeric values are equal:




255.0 = 255 = 0xff = 0xFF



All of these numeric forms are variations of the same numeric value. The decimal form of 255 or 255.0 is more tangible as base 10 is used commonly by human beings, but hexadecimal is used although not commonly. Hexadecimal has the advantage of being more compact for larger numbers and giving a simpler binary form of base 2 representation.


Numbers can be converted to different forms and used in different forms. In the ZeptoN programming language, many different forms of numbers and types are utilized in ZeptoN programs. Numbers are a form of data, and ZeptoN programs process input data to create resultant data for output.


Other number forms are possible, octal or base 8 and binary base 2, that can be utilized within a ZeptoN program.


Text Literals

Numbers are not the only form of data in a ZeptoN program. Another form of datum is from symbols and characters, and then putting those symbols or characters together to form text or string. This is literal data, or a literal character, or literal string of text, or more simply a literal.

String Literal

Consider the literal string:


“Hello, World!!!”


The string "Hello, World!!!" and then the character '!' is the exponentiation mark or a bang enclosed within a double-quote “ character.

Both the string and the character are text literals...the data is literal in that it is the series of symbols, or characters in sequence together. This is a text literal, where the text is a character or string, and the literal indicates actual datum.

Character Literal

Consider the character:


‘q’


The character ‘q’ is a literal character, the letter Q enclosed within a single-quote ‘ character. Text literals as characters and strings are often embedded within a ZeptoN program, often as a program constant. Such text literals are error messages, program warnings, and other information as output to the user of the ZeptoN program.

What Is Unicode?

The origins of Unicode [Wikip 2024] start in the late 1980s when there was a need motivated by the many incompatible character set encodings such as ASCII, EBCDIC, Xerox Character Code Standard, ATASCII, etcetera used on computer systems. Computers work only with numbers, so letters, numbers, and symbols are encoded by mapping number to symbol--the character set encoding. Yet for any two character encoding systems, there was no concern for compatibility between character sets, and often characters used on one computer system were "garbage" characters on another computer system.


Unicode, formerly "The Unicode Standard" [Unico 2024] is a standard character set that encodes all natural language characters to an integer number. Unicode can potentially encode 1.1 million characters, allowing for support of all the world's languages and scripts in a single, universe encoding standard.

Unicode Literals

All symbols or characters in ZeptoN are defined with Unicode. Words as identifiers are Unicode characters. So it is possible to have a Unicode character literal, using the integer value as a hexadecimal form for the integer of the character.


For example, character 32 is a blank space character. Integer number 32 is a hexadecimal number 20. The Unicode character literal is '\u0020' where the 'u' character as a prefix in the literal indicates a Unicode literal, and then a 4-digit hexadecimal number. The hexadecimal number 20 is 0x0020 in four hexadecimal digits.


Why use a Unicode literal as a character literal? Some literal text as characters are not on a computer keyboard. Consider the following character, symbol, or glyph you see all the time and ignore:


The copyright symbol © or © indicates the legal status of a copyright. The Unicode character literal is hexadecimal 0x00a9 as: '\u00a9'


The ZeptoN source code to output the copyright symbol is to print to the console:


print('\u00a9'); //print out the copyright symbol 

//print the copyright symbol in literal text 

println("This ZeptoN program is \u00a9 Copyright 2024."); 


The symbols and characters for Unicode can be referenced easily, and there are Unicode characters for many things, including emojis. 😜

Operators

The ZeptoN programming language has characters that form operators that are between words, numbers, and literals. The operators create various forms of expressions that are used to process data and create new data.


Algebra Equation


Consider the following algebra equation for the plot of a straight line:



y=mx+b



Rewriting this algebraic expression using ZeptoN language operators:


y = m * x + b ;


The symbols or characters '=' and '*' and '+' and ';' are all operators.


Some operators can be multiple characters for an operator.


Consider the operators:


y = (m << x ) + b++ ;


The operators '=' and '<<' and '++' are all multiple-character operators.

These kinds of operators are like a function, the operator takes one or two values and then creates a value result as the datum.

Other Operators

Parentheses such as '(' and ')' along with brackets ‘[‘ ‘]’ and then braces '{' and '}' are not used as operators that are like functions, but they are considered operators.


Other operators include the semicolon ';' which is a terminator. Other operators include a colon ':' and question mark '?' or hook, and so forth.


The great thing is the simplicity, while all of these operators have a different reason and semantic use, they are all considered “operators” in the ZeptoN programming language.


Part 4: A Program of ZeptoN

Consider all the elements in the simple, short ZeptoN program…


prog HelloWorld { 

begin {

   //ubiquitous program

   println("Hello, World!!!");

   exit(0);

  }//end begin }

//end prog HelloWorld

The Elements of ZeptoN

Now the elements and entities of the ZeptoN program are...


The comments:


//ubiquitous program 

//end begin 

//end prog HelloWorld


The operators:


{

//

"

;

(

)

}


Note that the characters for comment // and literal " are operators, strictly speaking; the operators do not perform any operation except to delimit and indicate, yet are operators in the ZeptoN programming language.


The words or identifiers:

prog

HelloWorld

begin

println

exit


The numbers:


0


Those are the elements of the ZeptoN program. The demonstrative ZeptoN program as HelloWorld.zept illustrates all the elements in the salad or fruit cocktail of language elements in the overall entity of a program.

Finally

Later the elements will be explored and discussed in greater detail…for now, this is the appetizer before the main course.


This is a bitter taste of ZeptoN, yet a sweet way to get the flavor…Zep to it! 😜

References