Yes, it is spaghetti code. It doesn’t even make use of my new <call>, <return> or <end> commands.

The nice thing about a scripting language built on top of XML is that the interpreter is super easy to write. I can use FirstChild and NextSibling much of the time for navigating to the next statement.

I wound up needing a stack to keep track of which block I was in (for <if>/<while>). As it turns out, <if> and <while> wind up being essentially the same code-wise. The only difference is that the node pushed to the block stack is the NextSibling in <if>, and the same node in <while>.

At this point, I have 9 total “commands”, but several of them, <if>, <while>, and <set> are rather complex. The engine can deal with both text variables and number variables (stored in C#’s decimal type). In fact, a number variable and a text variable can have the same name, as they are stored in different dictionaries, and escaped differently in text output. I suppose a third “namespace” would be labels, which can again have duplication.

There are no reserved words. There are no limitations on the names for things, other than a general prohibition on using # and $ in variable names unless you know the side effects of using them.

So, what is this good for?

At the moment, not much. Yes, it can run a script file, but that’s about it. It does text input and output.

However, with a small amount of work (mainly making certain methods visible), an application could conceivably load a script, set some text and number variables, run the script, and then examine some text and number variables.

For a slightly greater amount of work, it could have hooks for input/output and setting variables.

Or, if I never find a use for it, at least I can say I’ve made a general purpose scripting language.