I recommend checking out the iRule editor. It may be able to help you with the problem. https://devcentral.f5.com/d/irule-editor I'll admit that I haven't used it much, so I'm not 100% sure it can do what you are after.
Unfortunately there is no built-in interactive TCL shell (that I know of).
One option that may be a bit easier to bear with is using the edit command.
edit ltm rule MyiRule
Running this command will execute the vim editor, editing a temporary version of the irule. It will catch compilation errors and give you the option to re-edit the file.