Sample programs

Add your own sample programs

The table of sample programs is set up so that you can add your own µOCCAM examples. These need not be very long - between five and ten lines is a good size. Examples can be valid µOCCAM, which a compiler should accept, or invalid µOCCAM, which a compiler should reject. Try to think up several examples, each one concentrating on a single language feature.

Once you have devised your sample µOCCAM code, here is how to make them available on the course website.

  1. Make sure that you have registered for the course, and have an account within the dcs.ed.ac.uk domain. If not, please notify me and I shall make alternative arrangements.

  2. Put your sample µOCCAM code files in the directory /public/cs3/web/ipptests/. For example, the following five (at least) are already there.

        bad-sequence.reject
        faulty-continuation.reject
        final-comment.accept  
        simple-sequence.accept
        single-declaration.accept
    

    The suffice .accept indicates valid µOCCAM code, while .reject is for invalid code.

    The access permissions for this directory have been set so that everyone can edit their own files, but not delete those created by anyone else.

  3. Create a web page for each example. To use the standard format, copy the following text and insert your own values at every occurrence of ZZZ.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
    
    <!--#set var="program_title" value=" ZZZ Title of your example      " -->
    <!--#set var="program_file"  value=" ZZZ Name of file containing it " -->
    <!--#set var="program_type"  value=" ZZZ Choose either valid or invalid " -->
    <!--#set var="program_description" value="
    
    ZZZ Description of what µOCCAM features your program illustrates: why it is
    ZZZ valid, or why it should be rejected.
    
    " -->
    
    <!--#set var="author_name" value=" ZZZ Your name " -->
    <!--#set var="author_url"  value=" ZZZ URL for your home page " -->
    
    <!--#include virtual="sample.shtml"-->
    
    <!-- End of file -->
    

    Put this file in the same directory, with a .shtml extension. Check that it works: it should be available at http://www.dcs.ed.ac.uk/home/cs3/ipptests/<filename>.shtml.

  4. Now create a file <your userid>.html containing the following text, repeated for every example you have. This will give your rows in the table of examples. Again, fill in the ZZZ sections with your own information.

    <tr>
      <td><a href="ZZZfilename.shtml">ZZZ Test title</a></td> 
      <td>ZZZ Your name</td>
      <td>ZZZ Valid or Invalid</td>
      <td>ZZZ Brief description of test</td>
    </tr>
    

    Check that this file is also readable by all.

  5. Now look back at the table of sample programs to see if yours have appeared. You may need to force your browser to reload the page (Alt-R or even Alt-Shift-R under Netscape).

If you have problems with this, post your questions to the newsgroup. If you discover something others will need to know to get it to work, post that too.