I cannot post the code of the raytracer because it was part of the homeworks for the course CS184.1x: Foundations of Computer Graphics. The text file with the scripts that I used as input for the raytracer perhaps can give some idea about the building blocks:
size 640 480
maxdepth 1
camera 0 0 25 0 0 0 1 0 0 30
#camera 0 20 0 0 0 0 1 0 0 30
camera 10 -20 -26 0 0 0 1 0 0 30
camera 25 0 0 0 0 0 0 0 1 30
#camera 32 -32 12 0 0 0 0 0 1 30
directional 0 10 7 0.3 0.3 0.3
directional 0 -10 7 0.4 0.4 0.4
directional 5 17 -7 0.4 0.4 0.4
output borri.png
rotate 0 0 1 10
rotate 0 1 0 10
#ambient 0.1 0.2 0.1
shininess 20
scale 2 2 2
#translate 0 1 0
diffuse 0.0 1.0 0.0
specular 1.0 1.0 1.0
emission 0.0 0.1 0.0
### BASE
pushTransform
translate 0 0 -2.0
scale 1 1 0.1
sphere 0 0 0 3
popTransform
###############
###############
### O N E ####
###############
#### spheres
sphere 1 1 1 0.333
sphere 1 1 -1 0.333
sphere 1 -1 1 0.333
sphere 1 -1 -1 0.333
sphere 1.6180 0.6180 0 0.333
sphere 1.6180 -0.6180 0 0.333
pushTransform
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
#### spheres
sphere -1 1 1 0.333
sphere -1 1 -1 0.333
sphere -1 -1 1 0.333
sphere -1 -1 -1 0.333
sphere -1.6180 0.6180 0 0.333
sphere -1.6180 -0.6180 0 0.333
pushTransform
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
###############
### T W O ####
###############
pushTransform
rotate 1 0 0 90
rotate 0 1 0 90
#### spheres
sphere 1.6180 0.6180 0 0.333
sphere 1.6180 -0.6180 0 0.333
pushTransform
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
#### spheres
sphere -1 1 1 0.333
sphere -1 1 -1 0.333
sphere -1 -1 1 0.333
sphere -1 -1 -1 0.333
sphere -1.6180 0.6180 0 0.333
sphere -1.6180 -0.6180 0 0.333
pushTransform
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
popTransform
###################
### T H R E E ####
###################
pushTransform
rotate 0 0 1 90
rotate 0 1 0 90
#### spheres
sphere 1.6180 0.6180 0 0.333
sphere 1.6180 -0.6180 0 0.333
pushTransform
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate 1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
#### spheres
sphere -1 1 1 0.333
sphere -1 1 -1 0.333
sphere -1 -1 1 0.333
sphere -1 -1 -1 0.333
sphere -1.6180 0.6180 0 0.333
sphere -1.6180 -0.6180 0 0.333
pushTransform
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
pushTransform
rotate 1 0 -0.6180 -72
translate -1.6180 0 0
scale 0.2 1 0.2
sphere 0 0 0 0.6180
popTransform
###############################################
popTransform
diffuse 0.0 1.0 0.0
specular 1.0 1.0 1.0
emission 0.0 0.25 0.0
shininess 12
diffuse 0.0 1.0 0.2
specular 1.0 1.0 1.0
emission 0.0 0.1 0.0
#diffuse 0.0 0.0 1.0
#specular 1.0 1.0 1.0
#emission 0.0 0.0 0.1
#sphere 0 0 0 1.7