Oct 10, 2022 | gga

English-like Syntax

Indu uses an English-like syntax with very little use of symbols, unlike many other programming languages. This is intentional, but also quite controversial amongst professional programmers. I believe that using a natural language-like syntax will make Indu easier to learn, and so more available to people.

A natural language syntax means there’s a lot less to remember. Instead of having to remember that { means ‘open scope`, you can focus on understanding what it means to ‘open a scope’. It seems like a small thing, but the less you have to remember just to read what you’re looking at, the quicker you can learn.

Words people already know are more welcoming. Or, punctuation and mathematical-like symbols push people away. This is not just a belief, I’ve seen this. I’ve created variations for parts of the Indu syntax and then showed them to people. For example, should assignment be x = x + 10 or x := x + 10 or set x to x + 10? The first confuses the meaning of =. The second clears that up, but there’s now a new symbol to remember. The third seems overly wordy. Feedback was clear: the negative reaction to the first two from non-programmers was almost visceral. It was instant and complete rejection.

Good mathematical notation has a brevity that genuinely helps mathematical expression. Verbose languages, like COBOL, HyperTalk and AppleScript, have reputations for being unpopular with programmers. There are three common criticisms of English-like languages.

  1. These programming languages take longer to write. There’s just so much more typing.
  2. They take longer to read. There are so many more words.
  3. They’re ambiguous because English is ambiguous.

These are all good criticisms and have been kept in mind during the design of Indu. If an English-like language is easier to learn, and more welcoming, then how can these criticisms be addressed?

  1. A good IDE, with lots of auto-complete. Pretty straight-forward, actually.
  2. There are two kinds of verbose languages. There are languages that use words where others use symbols (begin vs { for example.) And there are languages that have a lot of structure: Pascal and COBOL are guilty of this.
  3. AppleScript was particularly ambiguous. I’ve found it to be a very frustrating language to use. There were two causes for this. Firstly, AppleScript was very reliant on applications supporting it. If an application had limited support, then some language features just wouldn’t work. Secondly, there were some quite advanced constructs, such as something like a loop comprehension, that were expressed as English-like clauses. These are hard to express clearly in something that’s trying to retain grammatical correctness.

From these concerns, there are a couple of points that I’ve been keeping in mind that are something like the beginnings of the philosophy of Indu.

  1. Keep the language small. There should only be a small number of ‘things’ that exist as part of the language. Where these things are the same they should look the same, and where they are different they should look different.
  2. Don’t use a symbol where a word would do, and don’t use a word where a symbol is well understood. For example, there is no need to use every type of bracket, but equally, replacing < with less than does not gain anything.

Gain early access

Complete our brief survey to gain access to our beta launch and secure a discounted "Founder" price for life. Your feedback will help shape the future of Pandita and influence future product features.

Gain access