I have a program that uses XML formatted rules to create executable code for run-time. I have to define some actions and logical constructs using my own dialect. I have OR, AND, and NOT constructs and now I need to implement IF..THEN..ELSE.
I’m trying to come up with a syntax that would make sense and here’s what I have so far:
<IF id='if-1'>
<TIME from="5pm" to="9pm" />
</IF>
<THEN id='if-1'>
<...some actions defined.../>
</THEN>
<ELSE id='if-1'>
<...other set of actions defined here.../>
</ELSE>
If looks difficult to read to me, but I don’t see a cleaner way to represent this without doing too much nesting. Does anyone have a suggestion? (not using XML is not an option at this point in time 🙂 )
I personally think that the if/then/else needs to be linked somehow.