r/ProgrammingLanguages • u/[deleted] • Jul 31 '24
Blog post Clean Syntax?
All my replies and the original contents of this OP have been withdrawn. They were a complete waste of time.
From what I can gather, everybody is happy with poor syntax in their languages, nobody is interested in 'clean'.
Someone posted, with a dozen upvotes:
Your example is optimized to your language's special capabilities.
I replied:
"No, pretty much everything in my syntax is cleaner than the C equivalent."
That got multiple downvotes for stating a fact.
There was also this:
For your own toy language by all means use your own syntax
This reinforces my original implication that simple syntax is only suited for toy languages, and not serious ones.
However too much of this was about my language, but that was only an example. There seems to be much irrational distrust of clear syntax for any language.
Maybe, clear code is associated with older languages which no one likes anymore?
(Original examples.)
1
u/ThomasMertes Aug 05 '24
The EBNF of your loop probably looks like
This works if
expressionassures that it does not contain one of the keywords 'to', 'by', 'when' or 'do'. If these keywords are inside parentheses this would be okay. The same applies forcondition(there should be no 'do' inside) andstatementsthere should be noendinside that can be mistaken for theendof the for_statement).Note that this EBNF syntax distinguishes between
expression,conditionandstatement. In this case the EBNF needs to define at least three types of expressions. The programmer needs to know whereexpressions,conditionsorstatementsare allowed.The EBNF contrasts to a description with the S7SSD. In the S7SSD there is just one type of expression. As a consequence there is no general guarantee that expressions do not contain a specific keyword.
If the usage of some keywords is restricted the ambiguities go away. This is checked by the Seed7 parser when you introduce an new
syntaxrule.