CS3 page · Project overview · Phase 1 · Phase 2 · Samples · Testing


CS3 Individual Programming Project

Sample Programs

This page presents a selection of test µOCCAM files. You can also add your own examples.

There are three types of sample program.

Programs in the third category are only relevant during phase 2 of the practical. Please do put in your own examples, and test your compiler on all the ones that appear on these pages.

WARNING! These tests programs are submitted by students on the course and classified as valid or invalid by their authors alone. The course lecturer can provide no reassurance that they actually are valid or invalid as stated.

Simple sequence Ian Stark Valid Simple sequence
Bad sequence Ian Stark Invalid Missing SEQ, PAR or ALT
Single declaration Ian Stark Valid Declares a variable
Faulty continuation Ian Stark Invalid Bad choice of line break
Final comment Ian Stark Valid Comment right at the end of program
Multiple Replicator Args Pete Andrews Invalid Basic replicator arguments test
Input and Output Stephen Barnes Valid This program checks for valid input and output statements.
Alternation Andrew Btes Valid Alternation processes in sequence
Nested ALTs Andrew Bates Invalid Nested alternation statements
BLANK LINE IN A CONTINUATION LINE Damien Bird Invalid The program checks that a blank line doesn't appear in a continuation line.
More Indentation Testing Euan Brodie Valid Tests indentation in continuation lines and comments
Expressions in VAL James Brown Invalid VAL's expression isn't constant
alternation-stuff Barry Cairns Valid Tests alternation statements among others
Multiple continuation lines Michael Cameron Valid Splitting some code over many lines
A rogue tab in a statement! Michael Cameron Invalid Using a tab to space out a statement
Final indentation Gary Campbell Valid Indentation at EOF
Tab indentation Gary Campbell Invalid Tab in the wrong place.
Invalid Comment Gary Campbell Invalid A comment hasn't been indented enough.
Valid Comments Gary Campbell Valid Bizarre comment indentation.
3spaces Kevin Cheng Valid Blank line with 3 spaces and a construct
Unary Minus Kevin Cheng Valid Testing Unary Minus
Complex expression Allan Clark Valid A valid complex expression
Extended example Allan Clark Valid Requires correct parsing of more than one language feature
How Not to do mOCCAM Rupert Connell Invalid It does exactly what it says on the tin, not mOCCAM...
Line indenting&commenting Michael Coughlin Valid Testing indents&comments
nested expressions David Couper valid Test whether parser allows nested expressions
Indents and Tabs Ewan Crowe Valid Tests Indentation, outdentation, indenting again and using tab characters instead of spaces.
Testing Tabs Laura Cull Invalid Testing for TABs after spaces
IF tester Alan Deans Valid Tests variable assigment and if conditionals
Seqs and Channels Alan Deans Invalid Tests sequence indentation using channel assignments
Comment befouling Tom Dearden Invalid Does a couple of acceptable things, then comments inappropriately
Crazy indentation Simon Delicato Valid tests large drops in indentation
constructs ZZZ Iain Findlay ZZZ Valid ZZZ Testing Constructions
Small sequence Paul Flanagan Valid This illustrates the fact that a sequence followed by no processes is valid.
Valid conditional Paul Flanagan Valid This program tests to see if a conditional construct with more than one choice is accepted.
Commented STOP Ross Fleming Valid Can your parser recognise STOP in a comment?
instancecontinuation David Forbes Valid Checks instance and continuation
Alt-Rep-Assign David Gilley Valid An Alternation With Replicator and Assign
Definition David Gilley Valid A Specification (Definition) and simple process
nonewline Duncan Grant Invalid No new line in processes block
PROC with list Alasdair Gray Valid Procedure call with list of arguements
PROC with no arguements Alasdair Gray Valid Procedure call with no arguements
comma ending Alasdair Gray Invalid Procedure call with list of arguements ending in a comma
Nested Arrays Marc Guerin Invalid Checks nested arrays
Expressions without Parenthesis Marc Guerin Invalid Checks parenthesis around expressions
Actuals and continuation lines Elizabeth Stewart Valid Tests on actual function and cont lines
Comments Keith Hargreaves Valid Checks all types of comment
Indent Keith Hargreaves Invalid A simple program to test indentation
Various stuff John Hawkins Valid Tests continuation lines, comments and various different constructs.
Outdent jump check Gareth Hewitt Valid Checks if a program allows a large jump from outdenting
Multiple comments Phil Hooker Invalid Should fail on incorrect comment indentation ecven though followed by a correct one
Multiple Constructions Rory Hunter Valid Slightly-longer-than-simple example with several constructions.
EOF / NL confusions Dave Keen valid EOF instead of NL after an assignment
SEQ/IF/Continuation Spyros Lambrinidis Valid SEQ an IF and continuation
Continuation lines Mike Langford Invalid Tests for Blank lines in continuation lines
Many tests Mike Langford Valid Tests many different aspects
Indent checks Chris Lisle Valid A few indentation checks.
Declaration and Comment Derek Long Valid Gives a declaration and a comment on the same line.
Mismatched Parentheses Casey Marshall Invalid Syntax check for parentheses.
Bad Continuation Line Casey Marshall Invalid Checks indentation in C.L.s
Various Grammar Tests Tom Mason Vaild Tests differents parts of your grammar
Smallwhile Chris McGowan valid Small Test of the while function
Womensage Chris McGowan valid Channel Input and Output
over indented Ian McWilliams Invalid Test whether parser allows statements to be over indented
Comment in Continuation Ian McWilliams Invalid Tests whether comments are allowed inside a continuation line
Checking continuation lines Gregor Miller Valid Continuation line checking
While loop Dan Mossop Valid While loop within a sequence
Instance Dan Mossop Invalid An instance with an expression argument
valid-proc-nocall.accept David H Muir Valid Illustrates procedure and then an empty sequence.
Cont lines Neil Plenderleith Invalid Checks different invalid continuation lines.
Valid Continuation Thomas Reisinger Valid This program tests continuation lines as well as comments.
Invalid Comment Thomas Reisinger Invalid This program is for testing comment indentation
Odd Continuation Line Indentation Thomas Reisinger Valid This program tests whether your program allows for odd continuation line indentation.
Continuations in actions Malcolm Rigg Valid Tests continuation lines in actions (input, output)
invalid test on single space Struan Robertson Invalid Invalid test on single space
Show me my bed! Iain Sampson Valid Scope and holes
2Programs1file.reject Andrew Scott Invalid Fails because there are 2 top level 'process'es
Comments and continuation William Scott Invalid Tests Continuation lines in conjuction with blank lines and comments
Can you finish indented? Stuart Shannon Valid Tricky to accept because it finishes with text that is still indented
how does your code handle commas? Stuart Shannon Invalid Invalid because there is no comma between here and comma which are both 'actuals'
General Test Neil Smith Valid General Test
Proctest Neil Smith Valid Contains two specifications
Valid Expressions Laura Snell Valid Checks valid expressions
Parallel Laura Snell Valid Checks PAR and instance
blank lines Lap Kiu Tang Valid A small program with lots of blank lines
BAD BAD Program Jackson Invalid Bad Program
Seq, Proc, While Test David Walters Valid A simple test of Seq, Proc and While
Simple For Statement Ian White Valid A simple For statement
Nested Sequences David Wilkie Valid Tests nested sequences associate processes correctly