Grant Edwards said:
....
You realize that was a joke, right?
Please, please don't write code like that. You'll be shunned
just like the BASIC programmers who switched to C and pulled
crap like
#define IF if (
#define THEN ) {
#define ELSE } else {
#define ENDIF }
Also,
#define ELSEIF } else if {
because using "ELSE IF" gives you unbalanced braces.
#define WHILE while (
#define DO ) {
#define DONE }
I don't remember BASIC ever using the syntax "WHILE cond DO ... DONE";
you've probably got it mixed up with another language.
"WHILE cond ... WEND" would be more accurate, but then it's harder to
deal with the ")" on the first line.
Also, you might want to support the QBasic DO...LOOP syntax, which had
four forms:
' 1. Pretest loop (while), positive condition
DO WHILE cond : statements : LOOP
' 2. Pretest loop (while), negative condition
DO UNTIL cond : statements : LOOP
' 3. Posttest loop (do...while), positive condition
DO : statements : LOOP WHILE cond
' 4. Posttest loop (do...while), negative condition
DO : statements : LOOP UNTIL cond
I doubt it's even possible to #define DO, LOOP, WHILE, and UNTIL to
handle all of them.