Many Rules
- Structured programming languages largely specify the order
that statements will be executed.
- Rule based systems by default do not.
- This is the power and problem with them.
- You can of course arrange it so that they are applied largely in
the order you want.
- One mechanism would be to have a program-counter fact, and each
rule would have a different value on the if side, and would
change the value on the then side to select the next rule to
apply.
- This requires the programmer to select which rule to come
next and largely erases the simplicity of a rule based system.
- However, you can reach a happy medium.
- You largely leave the system to choose which rule to apply next,
but in certain cases you manage it.
- The three basic control structures are branching (e.g. if then else),
looping, and function calls. You can do them all with rules.