[LOGO] Faculty of Mathematics and Computer Science
The Weizmann Institute of Science

On Executing Natural Language Requirements for Reactive Systems

M. Gordon and D. Harel

Bridging the gap between software requirement specification and execution has been the target of much research in recent years. Advances is natural language processing have made the translation of structured natural language into executable code feasible. However, reactive systems are considered to be the hardest when it comes to dynamics and execution; thus, going from some natural language rendition of requirements for a reactive system to a fully executable artifact is an important challenge. In this paper we describe a grammar for generating live sequence charts (LSCs) - a powerful executable extension of sequence diagrams for reactive systems. We have implemented an automatic translation from controlled natural language requirements into LSCs, and we demonstrate it on a simplified digital watch system, by translating structured English requirements for the watch into LSCs.


Demonstration

The demonstration includes sound.

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

The Watch Requirements and their translation to LSCs


Section Display
when the user presses the d button , if the display mode is time , the display mode changes to date , otherwise if the display mode is date , the display mode changes to time
when the user presses the a button , if the display mode is time , the display mode changes to alarm , otherwise if the display mode is alarm , the display mode changes to chime , otherwise if the display mode is chime , the display mode changes to stopwatch , otherwise if the display mode is stopwatch , the display mode changes to time
when the display mode changes and six seconds may have elapsed then if the display mode is not time , the display mode changes to time
Section Alarm
when the time value changes , if the time value equals the alarm value and the alarm state is enabled then the beeper turns on
when the clock ticks , the time increases by one second
when the user presses any button , the beeper shall turn to off
when the user pressed the c button , if the display mode is alarm then the display mode changes to alarm minutes , otherwise if the display mode is alarm minutes then the display mode changes to alarm hours , otherwise if the display mode is alarm hours then the display mode changes to alarm
when the user presses the b button if the display mode is alarm minutes , the display mode changes to alarm
when the user presses the b button if the display mode is alarm hours , the display mode changes to alarm
when the user presses the a button , if the display mode is alarm minutes , the alarm increases in one minute , if the display mode is alarm hours , the alarm increases by one hour
when the user presses the d button , if the display mode is alarm , if the alarm state is enabled , the alarm state changes to disabled , otherwise the alarm state changes to enabled
when the display mode changes , if the display mode equals alarm minutes , the display blinks in minutes , otherwise if the display mode equals alarm hours , the display blinks in hours , otherwise the display blinks in none
Section Update
when the user presses the c button , if the display mode is time , the display mode changes to update and the update type changes to seconds
when the user presses the c button , if the update type is seconds , the update type changes to minutes , otherwise if the update type is minutes , the update type changes to hours , otherwise if the update type is hours , the update type changes to date , otherwise if the update type is date the display mode changes to time and the update type changes to none
When the update type changes , if the update type equals seconds , the display blinks seconds , otherwise if the update type equals minutes , the display blinks minutes , otherwise the display blinks none
when the user presses the a button , if the display mode is update , if the update type is seconds , then the time increases by one second , otherwise if the update type is minutes , then the time increases by one minute
when the user presses the b button , if the display mode is update , the display mode changes to time
section light
when the user presses the b button , if the light state is on , the light turns off , otherwise if the light state is off , the light turns on
section chime
when the time hits the hour , if the chime state is enabled , the beeper turns on
When the user presses the d button then if the display mode is chime then if the chime state is enabled , the chime state changes to disabled , otherwise the chime state changes to enabled
section beeper
when the beeper turns on , as long as the beeper state is on , if two seconds have elapsed , the beeper beeps , the display mode cannot change
section power
when the power state changes to off , the display mode changes to off , the light turns to off , the beeper turns to off , the update type turns to none , the chime state changes to disabled , the alarm state turns to disabled
when the power state changes to on , the display mode changes to time , the light state changes to off , the beeper turns to off
section stopwatch
when the display mode changes to stopwatch and the display mode changes, store the current stopwatch mode then if the display mode is stopwatch , set the stopwatch mode to the last stopwatch mode
When the light turns on , sometimes the light color changes to green and other times the light color changes to blue
The following can never happen, when the user presses the d button, the light turns on