procedure main() write("type random-seed ") &random := integer( read() ) while line := read() do write( expression(), ", type " ) end procedure expression() return case ?2 of { 1: term() 2: term() || "+" || expression() } end procedure term() return case ?2 of { 1: operand() 2: operand() || "*" || term() } end procedure operand() return case ?7 of { 1: "x"; 2: "y"; 3: "z"; 4: "1"; 5: "2"; 6: "3"; 7: "(" || expression() || ")" } end # Generate random expressions. # From The Icon Programming Language 1st edn., Ch 7, sec 7.6, p 77.