Veteran funnyman Robin Williams has been given the green light to ad-lib scenes in his upcoming Tv sitcom The Crazy Ones.

The comedian will play eccentric advertising boss Simon Roberts in the new show, which marks his first small screen role since he shot to fame on the 1970s hit Mork & Mindy.

Series creator David E. Kelley, who also worked on Ally MCBeal, is encouraging Williams to express his creativity by allowing him to think up his own lines for the character.

Kelley explains, "He (Williams) says my words perfectly. Then he uses his. He manages inside the box, then we give him a few takes where he gets to take out of it."

Former Buffy the Vampire Slayer star Sarah Michelle Gellar has been cast as Williams' onscreen daughter in The Crazy Ones, which is due to debut in the U.S. this September (13).