Reminds me of something that happened long ago at Texas Instruments.
My co-workers and I programmed in straight assembler. But we wanted a higher level language to play with, hoping it would make us more productive. We all tried our hand at it, but our lead programmer came up with something novel -- he took the breakdown structure (BDS) of an existing language -- a very simple one -- and wrote a small assembly program that read in the BDS as input -- and then it would read in any program written in that higher level language, and reduce it to assembler.
I don't know what they call a BDS nowdays, but it looked something like this:
STATEMENT :== {ARITH_STATEMENT|IF_STATEMENT|LOOP_STATEMENT|begin |stop}
ARITH_STATEMENT :== {[SIGN] TOKEN OP ARITH_STR|ARITH_STR}
TOKEN :== {VARIABLE|INTEGER|REAL}
OP :== {+|-|*|/}
ARITH_STR :== {(ARITH_STR)|TOKEN|TOKEN OP TOKEN}
...
and so forth. Words in all upper caps are part of the BDS definition of the hi-level language. Actual key words in the hi-level language are lower case, like "begin", "stop", "call", "if" and so forth. The vertical bar, |, is read as "or". So, OP could be "+" or "-" or "*" or "/".
We got to playing with this, writing little routines in our new hi-level language (HLL) until somebody realized that the BDS text was in a buffer in the computer while executing the HLL. It was trivial then to make a small adjustment in the BDS. If I remember correctly, we modified this line:
TOKEN :== {VARIABLE|INTEGER|REAL|LANG}
A "LANG" as we called it, could be any line in the BDS definition!
Now, in our HLL, we could write statements such as:
BDS(7) = "OP :== {+|-|*|/|^}"
so that
OP :== {+|-|*|/}
became
OP :== {+|-|*|/|^}
We just added a new operator, ^ !!!!
This meant that in mid-program, we could change the rules of the language and use the new rules immediately.
Eventually, we got it so we could add or delete options from any given line of BSD without having to redefine the whole line. We did this by defining a few new lines of BSD which gave us operators for selecting a specific option within an existing BSD line, and for searching the BSD line by line, option by option.
We had a LOT of fun doing this, but it didn't come to much. We didn't have the time to spend all day experimenting with it, and producing something that wouldn't crash the whole computer was a really big challenge.
But the possibilities...
