Is a matte shadow shader even possible in OSL?

Is a matte shadow material like mental ray’s even posable in cycles or osl? If so I have a lot of osl learning to get done.

I think its possible in Cycles, but I don’t think as a single shader, but I don’t know about OSL.