Yes, the question is too general. It cannot be answered by pointing out any particular techniques or sharing any professional "secrets". It's just a method of education is some practical computer science, practice itself and familiarity with existing requirements and methods of creating of such requirements described in widely known literature. Also, the problem of getting such requirements cannot be considered without connection to the development of software and development methods. In particular, you should learn literature about
Unified Software Development Process (
http://en.wikipedia.org/wiki/Unified_Process[
^]), but a lot more, not just this.
You also need to learn and about compilers and try to use experience collected in their development by generations of scientists and developers, see:
http://en.wikipedia.org/wiki/Compiler[
^],
http://en.wikipedia.org/wiki/Compiler-compiler[
^].
And how about your education in computer languages in general? …Well, if I keep referencing all what's involved, I will never complete this post. Enough is enough. :-)
—SA