Back to table

Comments and continuation lines

The following is invalid µOCCAM. This program tests both when comments are valid and when they are invalid. It also tests continuation lines in conjuction with comments and blank lines and when continuation lines are valid.

Program file: /public/cs3/web/ipptests-phase-1/comms_and_cont.reject
PROC add(CHAN one,
                INT two) -- This should be accepted
  name.one := name.one +
          name.two      -- This should be accepted
:
SEQ
  WHILE name.three <
                 5
    -- This should also be accepted
    add(name.four,
          name.three)-- The number of spaces should not matter

    -- The above blank line should be OK
    SEQ
      VAL name.one IS  -- This should not be allowed
	name.four:
      name.one :=

        -- Neither should the above blank line or this comment
	name.five
  SKIP
STOP
--You should also be able to finish the file in the middle of a comment