Added documention for core programming structure. Added test cases as we...

Same pull request as https://github.com/groovy/groovy-core/pull/477. 
Yes. I did it.