To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Developing rich syntaxes for easy to learn coding

11 Oct 2019 at 15:09
Some languages really have easy to read and write syntaxes, whereas others sacrifice this for structure. What about the combination of both?

Often it is the case that languages draw inspiration from many other languages which themselves draw inspiration from less refined languages. They then continue to refine the syntax to the point where syntax becomes rich in it's descriptiveness but often sacrifice easy-to-write content. One language that has in my opinion achieved near English syntax is the SQL syntax. However, these languages, including SQL, then sacrifices structure.

Take this example and compare it to the other, which has more structure?

SELECT COUNT(*) FROM Table1 WHERE name = "John";
var i = 0;
while(i > 10) {

I would go down the route of saying that although the SQL reads much nicer, the JavaScript has more structure. SQL gets messier when more is added and as a result, the lack of structure becomes a problem.

So how does a language become rich in structure if not when reading like English? Well, the issue is that JavaScript is not as close the English syntax as SQL, yet it has a much better structure and syntax. JavaScript is more rigid than SQL since it's syntax is not simply about memorising the order of the words but the structure in which the words are placed. This allows JavaScript to have a more structured and flexible language syntax.

A rich language also has well-formed grammar. For instance, SQL syntax almost reads like English whereas JavaScript doesn't.

Warning. Here's where I talk about ZPE.

ZPE aimed from the very beginning to read like English whilst having a strong structure so that it can be understood well. I would say that like languages such as VB.NET, ZPE has both a strong structure and is also very descriptive. To allow ZPE to become descriptive, it adds syntactic sugar - stuff that often gets discarded by the compiler but helps make programs more readable making it easier to write and learn. It also offers a structure that follows VB.NET's structure, for example, if...then...end if. 

Try out ZPE for yourself to see what I mean.