I have defined my own grammar using yacc.My language gives user a flexibility to supply a extra header explicitly while invoking compiler which will be applicable to each of file to be compiled using my compiler.
I can think of two solutions to work with this scenario.
1.Append header to each of the file and compile each of the file separately.This is not a good idea as it involves editing the given source files which is necessary to append at beginning of the file.
2.Use yywrap to iterate over the list of files to be compiled and process header every time we find a new file. This is not good as it involves repeated parsing of the same file.
Without processing the header,files doesn't satisfy the grammar.
Please share the thoughts ,how it can be done in a best way ?