<p>Some languages such as Lua and Assembly Basic use keywords for syntax. This includes spelling out words such as <code>do</code> and <code>end</code> in Lua, or spelling out <code>add</code> or <code>mov</code> in assembly.</p>
<p>Other languages such as C or Java use punctuation marks in many parts of the syntax such as using <code>{</code> and <code>}</code> to designate a block, or using <code>+</code> <code>-</code> <code>*</code> <code>/</code> <code>=</code> etc as operators.</p>
<p>What are the advantages and disadvantages of each approach?</p>

<syntax><operators><style>
What are the advantages of keyword based syntax versus punctuation based syntax?
<p>One significant advantage of keywords over punctuation is <strong>searchability</strong>. If you are not sure what a keyword like <code>async</code> or <code>strictfp</code> means, you can search for it online. Most search engines can't handle search queries for punctuation like <code>::</code> or <code>~=</code>, and just ignore the punctuation in your query.</p>

CC BY-SA 4.0
2023-07-24T12:11:37.700Z
2023-07-24T12:11:37.700Z
kaya3
CC BY-SA 4.0
2023-07-24T23:38:26.100Z
Searchability is also useful to consider when naming the programming language itself.
dan04
CC BY-SA 4.0
2023-07-29T12:47:46.110Z
Try searching for anything in the bash manual (Linux shell).
Thorbjørn Ravn Andersen
<p>Another advantage of keywords: the language can be designed to allow extending the keywords (meaning the original grammar is simpler). Whereas operators will always cause a more complicated grammar (consider, for example, <code>++</code> vs <code>+</code> operators).</p>
<p>One such language is Kotlin. While it still has reserved keywords and a whole array of operators, you can simulate keyword operators through extension methods and alternative method call syntax (e.g. <code>5.and(6)</code> can be written as <code>5 and 6</code>).</p>
<hr />
<p>On a funny side-note, I'm currently working on a prototype language which specifically follows this approach and is completely operator-less (even the keyword kind).</p>

CC BY-SA 4.0
2023-07-08T22:26:00.563Z
2023-07-08T22:26:00.563Z
Christian
<p>Some main perceived advantages of punctuation-heavy syntax are that:</p>
<ol>
<li>it tends to fit more functionality into a smaller screen space;</li>
<li>it's usually easier to scribble out on paper;</li>
<li>it can avoid visual noisiness in the code.</li>
</ol>
<p>Some disadvantages are that:</p>
<ol>
<li>there is a learning curve for meaning of symbols;</li>
<li>certain symbols are relatively more difficult to enter on a standard keyboard;</li>
<li>there is no standard and obvious names or pronunciation for code elements.</li>
</ol>
<p>There are older languages that exemplify both extremes.</p>
<p>COBOL is wordy to the extent it almost acquires the property of being grammatically correct English - carrying the full overheads of natural language, though without anything like the full expressivity.</p>
<p>APL is so terse as to be almost unreadable, a quality that was widely regarded as having harmed not just the language but the credibility of its tenets more broadly.</p>
<p>The outer limits nowadays are regarded as being somewhere between Basic and C.</p>
<p>In my view, the relative advantages of punctuation-heavy languages have reduced over time:</p>
<ul>
<li><p>Screens have become much larger - enough that using a short word is no longer a real penalty against using a symbol.</p>
</li>
<li><p>Speaking about code has become far more important than handwriting or printing the code itself - emphasising standard vocabulary and pronounceability, rather than speed of writing out and compactness.</p>
</li>
<li><p>Code colourisers have made wordiness less visually ambiguous and cluttering.</p>
</li>
</ul>

CC BY-SA 4.0
2023-07-09T08:19:35.443Z
2023-07-09T08:19:35.443Z
Steve
CC BY-SA 4.0
2023-07-24T14:31:51.820Z
APL is only unreadable to those who don't understand it
Seggan
CC BY-SA 4.0
2023-07-24T14:58:05.620Z
@Seggan-OnStrike, indeed, and the syntax helps maximise that number.
Steve
<p>Advantages of keywords:</p>
<ul>
<li>Makes the language more closely resemble natural language, making it more accessible for beginners who are literate in the given natural language.
<ul>
<li>...and for blind or visually-impaired programmers using audio screen readers.</li>
</ul>
</li>
<li>Depending on your editor font, can be easier to visually distinguish (compared to say, <code>:</code> versus <code>;</code>).</li>
<li>Often easier to type on a keyboard due to not requiring Shift or Alt combinations.</li>
<li>Less likely to tempt people into making questionable operator overloading decisions like using bitshifts to do file I/O.</li>
</ul>
<p>Advantages of punctuation:</p>
<ul>
<li>More concise, especially for mathematical expressions (e.g., <code>a = b * c + d;</code> instead of COBOL-style <code>MULTIPLY B BY C GIVING TEMP. ADD TEMP TO D GIVING A.</code>)</li>
<li>Cannot conflict with a user-defined identifier, thus avoiding a backwards-compatibility issue when adding a new operator to the language.</li>
<li>Is (human) language independent, thus reducing the amount of vocabulary that a non-English-speaker (or whichever language your keywords are from) needs to learn in order to use your language.</li>
</ul>
<p>Note that most languages aren't purely keyword-only or punctuation only, but a mix of both.</p>
<ul>
<li>Famously wordy COBOL still uses punctuation: <code>*</code> to start a comment, <code>.</code> to terminate a statement, <code>'</code> to quote a string literal, <code>&lt;</code> <code>=</code> <code>&gt;</code> for comparisons, and <code>(</code> <code>)</code> for field lengths and array indexes.</li>
<li>Punctuation-heavy C still uses words for its data types and control-flow statements.</li>
</ul>

CC BY-SA 4.0
2023-07-07T22:33:43.037Z
2023-07-21T22:15:02.460Z
2023-07-21T22:15:02.460Z
dan04
CC BY-SA 4.0
2023-07-08T03:04:56.040Z
COBOL also works without some of the punctuation operators, as in  "IF PAYMENT IS LESS THAN BILLED PERFORM FORECLOSURE, OTHERWISE …".  One of the major design points of the language was that managers (with little math and no programming skills) should be able to read the code and sort-of understand it.
Ray Butterworth
CC BY-SA 4.0
2023-07-08T07:31:12.397Z
I think the bitshifts in C++ were actually intended to mean "send" and "receive". Other languages still have vestiges of this. go uses <- for recieve from channel. Without a "channel" style model it didn't really take off.
Bruce Adams
CC BY-SA 4.0
2023-07-10T00:17:32.967Z
"more accessible for beginners" That's purely subjective. If you only understand English and I task you to write an application in a keyword-only COBOL-like Chinese language, you'll be a beginner and won't have a clue what's going on (and it's more than about vocabulary). But the average programmer is Han, so should I expect you to understand it?
Longinus
CC BY-SA 4.0
2023-07-21T22:13:49.127Z
@Longinus:  Well, I meant beginners who are already literate in the particular natural language on which your programming language's syntax is based.  An English speaker is obviously not going to think that Mandarin Chinese-based keywords are intuitive (or vice-versa), which is why I listed "human language independent" as an advantage of punctuation.
dan04
CC BY-SA 4.0
2023-07-24T14:29:16.677Z
"often easier to type on a keyboard" but words are typically longer than punctuation, so it cancels out
Seggan
# What are the advantages of keyword based syntax versus punctuation based syntax?
Posted by: username_0 on 2023-07-07
Some languages such as Lua and Assembly Basic use keywords for syntax. This includes spelling out words such as `do` and `end` in Lua, or spelling out `add` or `mov` in assembly.

Other languages such as C or Java use punctuation marks in many parts of the syntax such as using `{` and `}` to designate a block, or using `+` `-` `*` `/` `=` etc as operators.

What are the advantages and disadvantages of each approach?
**Tags:** syntax operators style
---
## 4 answers
### Answer by username_2 on 2023-07-07. Score: 10 | Accepted answer
Advantages of keywords:

* Makes the language more closely resemble natural language, making it more accessible for beginners who are literate in the given natural language.
  + ...and for blind or visually-impaired programmers using audio screen readers.
* Depending on your editor font, can be easier to visually distinguish (compared to say, `:` versus `;`).
* Often easier to type on a keyboard due to not requiring Shift or Alt combinations.
* Less likely to tempt people into making questionable operator overloading decisions like using bitshifts to do file I/O.

Advantages of punctuation:

* More concise, especially for mathematical expressions (e.g., `a = b * c + d;` instead of COBOL-style `MULTIPLY B BY C GIVING TEMP. ADD TEMP TO D GIVING A.`)
* Cannot conflict with a user-defined identifier, thus avoiding a backwards-compatibility issue when adding a new operator to the language.
* Is (human) language independent, thus reducing the amount of vocabulary that a non-English-speaker (or whichever language your keywords are from) needs to learn in order to use your language.

Note that most languages aren't purely keyword-only or punctuation only, but a mix of both.

* Famously wordy COBOL still uses punctuation: `*` to start a comment, `.` to terminate a statement, `'` to quote a string literal, `<` `=` `>` for comparisons, and `(` `)` for field lengths and array indexes.
* Punctuation-heavy C still uses words for its data types and control-flow statements.
> **Comments:**
> **username_7** (2023-07-08): COBOL also works without some of the punctuation operators, as in  "IF PAYMENT IS LESS THAN BILLED PERFORM FORECLOSURE, OTHERWISE …".  One of the major design points of the language was that managers (with little math and no programming skills) should be able to read the code and sort-of understand it.  
> **username_8** (2023-07-08): I think the bitshifts in C++ were actually intended to mean "send" and "receive". Other languages still have vestiges of this. go uses <- for recieve from channel. Without a "channel" style model it didn't really take off.  
> **username_9** (2023-07-10): "more accessible for beginners" That's purely subjective. If you only understand English and I task you to write an application in a keyword-only COBOL-like Chinese language, you'll be a beginner and won't have a clue what's going on (and it's more than about vocabulary). But the average programmer is Han, so should I expect you to understand it?  
> **username_2** (2023-07-21): @Longinus:  Well, I meant beginners who are already literate in the particular natural language on which your programming language's syntax is based.  An English speaker is obviously not going to think that Mandarin Chinese-based keywords are intuitive (or vice-versa), which is why I listed "human language independent" as an advantage of punctuation.  
> **username_6** (2023-07-24): "often easier to type on a keyboard" but words are typically longer than punctuation, so it cancels out  
---
### Answer by username_1 on 2023-07-24. Score: 6
One significant advantage of keywords over punctuation is **searchability**. If you are not sure what a keyword like `async` or `strictfp` means, you can search for it online. Most search engines can't handle search queries for punctuation like `::` or `~=`, and just ignore the punctuation in your query.
> **Comments:**
> **username_2** (2023-07-24): Searchability is also useful to consider when naming the programming language itself.  
> **username_3** (2023-07-29): Try searching for anything in the bash manual (Linux shell).  
---
### Answer by username_4 on 2023-07-08. Score: 5
Another advantage of keywords: the language can be designed to allow extending the keywords (meaning the original grammar is simpler). Whereas operators will always cause a more complicated grammar (consider, for example, `++` vs `+` operators).

One such language is Kotlin. While it still has reserved keywords and a whole array of operators, you can simulate keyword operators through extension methods and alternative method call syntax (e.g. `5.and(6)` can be written as `5 and 6`).

---

On a funny side-note, I'm currently working on a prototype language which specifically follows this approach and is completely operator-less (even the keyword kind).
---
### Answer by username_5 on 2023-07-09. Score: 3
Some main perceived advantages of punctuation-heavy syntax are that:

1. it tends to fit more functionality into a smaller screen space;
2. it's usually easier to scribble out on paper;
3. it can avoid visual noisiness in the code.

Some disadvantages are that:

1. there is a learning curve for meaning of symbols;
2. certain symbols are relatively more difficult to enter on a standard keyboard;
3. there is no standard and obvious names or pronunciation for code elements.

There are older languages that exemplify both extremes.

COBOL is wordy to the extent it almost acquires the property of being grammatically correct English - carrying the full overheads of natural language, though without anything like the full expressivity.

APL is so terse as to be almost unreadable, a quality that was widely regarded as having harmed not just the language but the credibility of its tenets more broadly.

The outer limits nowadays are regarded as being somewhere between Basic and C.

In my view, the relative advantages of punctuation-heavy languages have reduced over time:

* Screens have become much larger - enough that using a short word is no longer a real penalty against using a symbol.
* Speaking about code has become far more important than handwriting or printing the code itself - emphasising standard vocabulary and pronounceability, rather than speed of writing out and compactness.
* Code colourisers have made wordiness less visually ambiguous and cluttering.
> **Comments:**
> **username_6** (2023-07-24): APL is only unreadable to those who don't understand it  
> **username_5** (2023-07-24): @Seggan-OnStrike, indeed, and the syntax helps maximise that number.  
---
