Back to table

Extended example

The following is valid µOCCAM. Many examples so far test (as recommended) only one feature of the language here is a valid extended example to make sure your acceptor can handle more than 3 lines of code.

Program file: /public/cs3/web/ipptests-phase-1/extended.accept
SEQ
  PROC get ()
    jojo := man
  :
  PROC back (INT sweet)
    sweet := martin
  :
     --this is a valid comment
  yousay (hello, goodbye)
  STOP
  SKIP
  SEQ --comment
    --This is a comment
	--this is also a comment
    --this is still a valid comment
	--there are no invalid comments up to this point in the file
    allan := 32 + 33
    allan ? clark
    allan ! 35 + 22
    ALT
      allan ? clark
        out ! clark
      lucy & sky ? diamonds
        likepigs ! ontherun
    IF
      holes < fourthousand
        blackburn := lancashire
      x > y
        small[i] := countthemall
      TRUE
        fill := thealberthall
    WHILE jude <> makeitbetter
      SEQ
        billy ? shears
        like ! tosingasong
    SEQ norwegian = 1 FOR 10
      PAR
        IF
          time < wine
            laugh := bath