Once again, majky, if you are high school student, try to do research yourself and basically rely on your school material, not on help from internet.
Lexical analyze and parsing is probably the chapter in your school book... You are the only one who know exactly what is the reason for assignment.
If you offer to your teacher proposed solution from this thread, you will probably receive zero or 1 point for the effort (from maximum 10)...