procedure main()
   while writes(line := read()) do
      if line ? (X() & pos(0)) then write(" accepted")
      else write(" rejected")
end

procedure X()
   suspend T() | (T() || ="+" || X())
end

procedure T()
   suspend E() | (E() || ="*" || T())
end

procedure E()
   suspend ="x" | "=y" | "=z" | (="(" || X() || =")")
end
