--
-- This is a test of semantic checking for procs
--  with no parameters.
--
-- you will need to run this several times, with some lines commented out
-- to see that you catch all the errors
@c+
module test20 -- check semantics of procs
private
	integer i, res;
	proc factorial(ref integer res)
		integer j;
		proc j(ref integer result); -- name conflict
		proc i(ref integer res); -- ok 
		proc k(val integer x; ref integer res); -- ok
		proc times(ref integer result)
		begin
		   i := i*j; --illegal, i is a proc here.
		   if j # i ->	j := j+1;
--				times(); --wrong number of arguments
		   []  j = i -> skip;
		   fi;
		   fubar(result); -- not declared
		end;
		proc i; -- illegal, should be def
	begin -- body of factorial
	  j := 1;
	  times(j, res);--wrong number of arguments
	end;  -- error no body for k;
begin -- module body
	i := 6;
	factorial(i);
    write "factorial of 6 = ", i, " (should be 720)";
end.

