An overview of the scripting language

It is possible to write all analysis modules in Java™ and that may be an appropriate route in many cases. There are times however when a user might want to avoid the full sophistication of Java and instead use some very simple scripting capability to invoke existing analyzers. For those occasions we have provided a language based on the concept of a state machine which is entered and then proceeds to move between states until it has completed its analysis. We deliberately avoid the inclusion of a looping construct and further constrain the language to ensure that a state can only be visited once. The aim is to ensure that a script can be quickly constructed and will not result in endless repetition of analysis. The language is comprised of a number of keywords

import {name}
define the full package name of an analyzer and make it available in its short form in the script
state {name}
define the name of the current state
{variable} = {analyzer}:{rule}
set a variable to be the result of running an analysis
if ({boolean expression})
the only conditional statement
else
handle the case where the condition is false
fi
end the if statement
newState {state name}
change to a new state which is defined by the 'state' keyword
report {analyzer}
invoke the produceReport on the given analyzer
help {analyzer}
show help for the given analyzer
print {message}
print a message for the user
error {message}
print an error message in the result summary
terminate {result}
end the script with the given result which can be OK, ERROR, FATAL, TRUE, FALSE.

a script must be stored in a file with the extension .sml (state machine language). The next section shows an example of a script used to link together a couple of analyzers into a simple analysis flow.

© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.