Implementing the redirection

Hi all
I am facing a problem with redirection. Its somewhat related to parsing.
I am following the following steps.

  1. take the command and tokenize it.
  2. if redirection is there then give it to redirection unit
  3. if pipe is there give it to piping unit.
  4. do until the command ends

Could you please tell me are these steps right as I am a new guy. Please tell me how Shell do the parsing of a command.
I am doing in C language.