// stmtcount(f) - count the number of statements in f stmtcount:= proc(f) local i; begin case type(f) of DOM_FUNC_ENV do return(stmtcount(op(f, 1))) of DOM_EXEC do return(stmtcount(op(f,5))) of DOM_PROC do return(stmtcount(op(f,4))) of "_stmtseq" do return(_plus(stmtcount(op(f,i)) $i=1..nops(f) )) of "_case" do return(_plus(stmtcount(op(f,2*i-1)) $i=2..nops(f) div 2)) of "_if" do return(stmtcount(op(f,2))+stmtcount(op(f,3))) of "_while" do return(stmtcount(op(f,2))) of "_for" do return(stmtcount(op(f,5))) of "_repeat" do return(stmtcount(op(f,1))) of DOM_NIL do return(0) otherwise return(1) end_case end_proc: