Rule of thumb for writing parser to parse a file using lex and yacc
Understand the file structure
Understand the tokens in which data is to be parsed
Understand the tree in which parsed data is to be stored
Once you have clear understanding of above three factors, you could move ahead with planning lexer first, and then writing rules for parser , and then writing lexer and parser.
Understand the file structure
Understand the tokens in which data is to be parsed
Understand the tree in which parsed data is to be stored
Once you have clear understanding of above three factors, you could move ahead with planning lexer first, and then writing rules for parser , and then writing lexer and parser.

