1. you can define keywords, operators, grammar rules, general concepts endorsed by the language, etc.
2. do your worst
3. we are starting from the ground up, so it is prohibited to import complete keyword sets from an existing language (no OK, ALL JAVA KEYWORDS, THREAD OVER, HURRRRRRRRRR)
4. and we need a name for this language as well
Name:
Anonymous2010-06-26 20:34
MASO
A new language for modern computing.
I'm going to start off with some core features and their justifications:
1) ALL IDENTIFIERS MUST BE AT LEAST 20 CHARACTERS
Now that even consumer computers have gigabytes of memory, there is no justification for short identifiers. Everyone knows that code is only written once but read many times, so this rule eliminates confusing variable names like 'i' and 'x'.
2) EVERY LINE MUST HAVE A COMMENT
Self-explanatory.
3) EACH COMMENT MUST BE AT LEAST 30 CHARACTERS AND END WITH A PERIOD
This is to discourage programmers from circumventing rule (2) by making comments that only contain, say, a space.
4) EVERYTHING IS AN OBJECT
Unlike, say, C++, there a no 'primitive' types. This simplifies container classes, eliminates issues with boxing, etc.
5) EVERY OBJECT IS A DICTIONARY
Similar to Javascript and Lua, this simplifies the language implementation and provides run-time flexibility.
6) EVERY OBJECT DICTIONARY IS AN XML STRING
People already know XML and may already have editors that support XML. Performance might be a little worse, but performance matters for only around 10% of any given program and, as we all know, that part is written in C++ anyway, right?
7) ALL BINARY OPERATOR EXPRESSIONS MUST HAVE PARENTHESES
Should (a ^ b << c) be interpreted as ((a ^ b) << c) or (a ^ (b << c))? Just a few extra parentheses eliminate operator precedence mistakes.
8) THERE IS NO EQUALITY TEST OPERATOR
Rather than have confusion between '=', '==', ':=", etc, the equality test operator ('==' in C) is eliminated. If you want to see if A and B are equal, check if (!(A < B) && !(A > B)).
9) ALL OBJECTS MUST SUPPORT THE '<' AND '>' OPERATORS.
This is because of rule (8). Because operator overloading can be misused, overloading any other operators is prohibited.
10) ARRAYS ARE ONE BASED
Non-programmers might be involved in the production process and they are used to arrays that start at one. See Lua for additional reasons why this is a good idea.
--------------------
Operators and syntax
--------------------
1) OPERATORS
+, -, *, /, ^, and, or, not
note: to make the language more orthogonal, 'not' is a binary operator
2) FLOW CONTROL
if else, while, sometimes, don't
note: something in a sometimes block will happen some times and not others
note: something in a don't block will never happen, even if the same statements
appear elsewhere outside of a don't block
3) OTHER KEYWORDS
new, delete, start, kill, injure, maim
5) BLOCKS
There some controversy in the programming language community about significant whitespace. In MASO a compromise is reached: blocks must begin with a '{', but afterwords use significant whitespace (no '}' is needed).
6) STATEMENTS
Statements end with a '.', or a '?' or '!'. If they end with a '?' or '!' they can be referred to as "questions" or "exclamations".
--------------------
Example code
--------------------
#include <stdio.h>