A very quick and dirty implementation:

step {

scale [100%, riser, 100%]

instance "wall_1m"

}

stairstep : width < 0.1 {}

stairstep {

module step

module {

scale [100% - tread, 100%, 100%]

move [0, riser, 0]

module stairstep

}

}

railingRight {

center xy

move [-2.5, 5, 0]

scale [H, 1, 1]

rotate z deg

instance "wall_1m"

}

railingLeft {

center xy

move [-2.5, 5, 100%-m]

scale [H, 1, 1]

rotate z deg

instance "wall_1m"

}

main {

module railingRight

module railingLeft

const m 1

const riser 1

const c (height/width)

const Osq pow(height, 2)

const Asq pow(width, 2)

const H sqrt(Osq+Asq) //get the length of the hypotenuse

const pi 3.141592

const b 0.596227

const rad (pi/2)*(b*c + c*c)/(1+2*b*c+c*c) //estimate arctan - returns radians

const deg rad*180/pi

const tread (width * riser) / height

module {

material Stairs

module stairstep

}

}