Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

The importance of good syntax

The importance of good syntax

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?

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

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 to the English syntax as SQL, yet it has a much better structure and syntax. JavaScript is more rigid than SQL since its 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. Some languages such as PHP are even worse, where sometimes you expect something like substr to actually be written as sub_str to follow the other string methods such as str_replace, but instead it omits the _ for some reason. This is very irritating as a PHP developer myself. 

Looking at my own ZPE

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.

Posted by jamiebalfour04 in Technology
rich
language
syntax
development
code
zpe
Comments
Powered by DASH 2.0
Scan and keep for the latest article or review every time!
https://www.jamiebalfour.scot/redirect/action/latest-article/