Reasoning About Programs: CAL Tool
HOME | MANUAL | ABOUT | LINKS | DOWNLOAD | CONTACT

Manual

Installation
Getting Started
    - Loading Examples
    - Running Examples
    - Interpreting Results

Try your own examples
    - Inputting your own conditions
    - Inputting your own code
           - Simple assignment
           - More Assignments
           - If, Then, Else Structures
           - While Loops

Error Messages

0 Installation
  • Download caltool.zip.
  • Extract the files to the same directory.
    The zip file contains 7 files in total. caltool.jar and 6 examples.
    You can use the command: unzip caltool.zip -d dir under linux.
  • Use the command: java -jar caltool.jar to run from it's directory.
    Or simply double click the jar file under Windows.
1 Getting Started


The main interface of the program.

The large area in the middle labelled Code Window, displays the lines of code that you enter. The Code Window window is editted using the four buttons directly beneath it.
Above the Code Window is a field for the Precondition, below is the field for the Postcondition. You may type your Conditions directly into these fields, or if you prefer, use the Input buttons on the right-hand Panel.
Below the Input Buttons are the three Running Controls, once you have given some input, these three buttons let you control the demonstration. Finally there is the Output Window at the bottom to display the results.

1.1 Loading Examples


Loading Preset Examples.

Click Help > Examples on the Menu Bar and select your chosen example from the menu.

1.2 Running Examples


Example 1 Loaded.

Once the example has successfully loaded, as above, you can then attempt to Run the Hoisting Process by either Running or Stepping through the code. Use the control buttons on the right to do so.

1.3 Interpreting Results

Text Here.Text Here.Text Here.Text Here.Text Here. Text Here.Text Here.Text Here.Text Here.Text Here. Text Here.Text Here.Text Here.Text Here.Text Here.

2 Try your own examples

The main aspect of this program is that you are able to try your own examples and see what affect minor changes have on the hoisting process.
To input your own examples you will need to use a particular syntax so that your code and conditions may be parsed.
Inputting is achieved by a combination of the input buttons and the keyboard.


2.1 Inputting your own conditions

Firstly select the textfield you wish to input text into, either the Precondition Field at the top, or the Postcondition Field at the bottom.
You can then use the keyboard or the Input buttons to add text to that field. A simple condition is a variable (one of w,x,y and z) followed by a comparative operator (eg. <,>,==), followed by a number, or another variable.
eg. x>5 x<=10 w!=y

You can also build conjunctions using the logical operator 'and' (&&).
eg. x>5 && y<10

Which means both the simple statements should be true for the whole statement to hold.
Similarly you can build disjunctions using the logical operator 'or' (||).
eg. x>5 || y<10

Which means either of the two simple statements could be true for the whole disjunction to be true.
You can also combine disjunctions and conjunctions, but note that conditions will be interpreted in Conjunctive Normal Form (CNF).
This means that disjunctions take precedence over conjunctions:
eg. x>5 || x<10 && y<10 && z==0 || z==5

Would be interpreted as:
(x>5 || x<10) && (y<10) && (z==0 || z==5)

The bracketed elements (clauses) can be simple conditions or disjunctions.

2.2 Inputting your own code

To input a line of code click the 'Add Line' button. This brings up the following popup:


Add Line Popup.

You can type your code directly into the box, or use the input buttons provided. The program uses a Java/C type syntax for the code.

2.2.1 Simple assignment

The most basic assignment is a variable, an equals sign, and a number, with a semicolon to end the statement.
eg. x=1;

Meaning the variable named 'x' is assigned the value 1.

2.2.2 More Assignments

Assignments may also including numerical expressions:
eg. x=3+6/3+5-4;

Note that the expression has calculator style precedence, ie. which ever operation comes first on the line is executed first. So this example evaluates as follows:
3+6=9 9/3=3 3+5=8 8-4=4

Assignments may also be formed in terms of the variable they assign to:
x=x+1;

This adds one to the current value of x.
Assignments may also include other variables:
x=x+y;

Here, x is assigned its current value plus the value of y.

2.2.3 If, Then, Else Structures

Not Currently Implemented.

2.2.4 While Loops

Not Currently Implemented.

3 Error Messages

Text Here.Text Here.Text Here.Text Here.Text Here. Text Here.Text Here.Text Here.Text Here.Text Here. Text Here.Text Here.Text Here.Text Here.Text Here.