You have a Cray then.



r0 = 4;
r1 = 2;


for (v = [0:360])
{
for (u = [0:360])
{
assign (A = ((r0 + r1 * cos(v)) * cos (u)), B = ((r0 + r1 * cos(v)) * sin (u)), C = (r1 * sin(v)))
{
translate ([A,B,C])
sphere (r=1);
}
}
}

I think it is right.
AB and C are xy and z (I thought xyz maybe special within Openscad), your angles are u and v, radii are r0 and r1.